Showing posts with label Java 10. Show all posts
Showing posts with label Java 10. Show all posts

Thursday, May 2, 2019

Java 10 LVTI: Local Variable Type Inference Explained with Examples

Java 10 Local Variable Type Inference:

In this tutorial, We will learn what is Java 10 Local Variable Type Inference with examples.

Introduction:

Java 10 introduced a new shiny language feature called local variable type inference and One of the most obvious enhancements in JDK 10.
Type inference refers to the automatic detection of the datatype of a variable, done generally at the compiler time.

For the local variables, we can use a special reserved type "var" instead of actual type and var is not a keyword. This enhancement helps in reducing the boilerplate code.

Java 10 LVTI - Local Variable Type Inference Explained with Examples