Declare Variables in Local Variable Type Inference in Java 10

Create new package named demo. In this package, create new java class named Main.java as below:

package demo;

public class Main {

	public static void main(String[] args) {

		var quantity = 123;
		var fullName = "abc";
		var status = true;
		var price = 4.5;
		var key = 'y';
		System.out.println("Quantity: " + quantity);
		System.out.println("Full Name: " + fullName);
		System.out.println("Status: " + status);
		System.out.println("Price: " + price);
		System.out.println("Key: " + key);

	}

}




Quantity: 123
Full Name: abc
Status: true
Price: 4.5
Key: y