October 30, 2017

More precise details of time can be obtained in Java using nanoTime()

Code snippet: public class NanoTimeInJava{public static void main(String args[]){NanoTimeInJava nanoTimeInJava = new NanoTimeInJava();nanoTimeInJava.proceed();} private void proceed(){//The following nanoTime() method in System class provides the time in nano secondsSystem.out.println(“Time in nano seconds : “+System.nanoTime());}} /* Expected output: [[email protected]]# java NanoTimeInJavaTime in nano seconds : 698344477290095 */

Use the Let Keyword to Create Variables in a LINQ Query

There are cases in which you will find the need to have variables inside a LINQ query to hold an evaluation result. The Let keyword helps in this case. See below for an example: var oldTeens = from kidAge in kidsAges let age = kidAge 14 where age select kidAge;var