Please reach out to us for any queries or suggestions:
Yes, you read it right. ‘var’ is now available for Java developers as well. JDK 10 which got released on March 20 th , 2018 rolled out a shiny feature which allows developers to use var for declaring local variables. We all know that Java is static typed language. But wait a minute, does this inclusion of var now make Java a dynamic typed language? As we know JavaScript allows to define variables using var and it is indeed dynamically typed language. Quick refresher of static and dynamic types: Static type – Types cannot change at runtime. For example, below java code will not compile int myvar = 1; myvar = “Toyota”; myvar = ["Saab", "Volvo", "BMW"]; Dynamic type – Types can change at run time. For example, below code in JavaScript is valid var myvar; myvar = 1; myvar = “Toyota”; myvar = ["Saab", "Volvo", "BMW"]; So to answer the question “Does this inclusion of var now make Java a dynamic t...