August 2018
Intermediate to advanced
524 pages
14h 45m
English
In Java, just like in almost any programming language, we use variables. The variables in Java are typed. This means that a variable can hold a value of a single type. It is not possible for a variable to hold an int type at some point in the program and later a String type. When variables are declared, their type is written in front of the variable name. When a local variable gets the initial value on the line where it is declared, it is possible to use a special reserved type named var. It means the type that is exactly the same as the type of the expression on the right-hand side of the assignment operator.
This is how the code looks like:
var n = names.length;
It can also be written as follows:
int n = names.length;
This is ...