A variable is a container that stores a value in memory. A variable can hold only one value at a time.

A data type is the format of the data that can be assigned to a variable.

Creating a Variable

When we write the data type and the name of the variable, we are declaring the variable. Declaration is giving a name and data type to a variable.

The variable gets the value returned from calling the method.

Printing

System.out.print() prints the String, and the cursor stays on the current line.

System.out.println() prints the String, and the cursor moves to the next line.