June 2018
Intermediate to advanced
280 pages
7h 46m
English
This is probably the biggest change in Java 10 that will impact the way you used to code. Java is always known as a strict type language. Well, it still is, but with Java 10 you have the liberty of using var when declaring local variables instead of providing proper type.
Here is an example:
public static void main(String s[]) { var num = 10; var str = "This is a String"; var dbl = 10.01; var lst = new ArrayList<Integer>(); System.out.println("num:"+num); System.out.println("str:"+str); System.out.println("dbl:"+dbl); System.out.println("lst:"+lst);}
We are able to define and use variables without specifying the type. But this feature is not without its set of restrictions.
You cannot declare a class scope variable ...
Read now
Unlock full access