Variables
 

A variable is a named memory location which temporarily stores data that can change while the program is running.
A final is a named memory location which temporarily stores data that remains the same throughout the execution of the program. It is a constant variable in the program.

The type of a variable indicates what kind of value it will store.

The name of a variable is known as its identifier.

A variable is given a value through an assignment statement.

Java recognizes different data types of variables depending upon what kind of data they can contain. Java has eight built-in primitive data types designated by reserved words:

byte
short
int
long float
double
char
boolean

Variables of different types occupy different amounts of memory space and are described as having different sizes.

Of the eight primitive data types in Java, the four most commonly used are: double, int, boolean, and char . When you learn about objects, you will discuss the differences between primitives and objects.

(c) Shilpa Sayura Foundation 2006-2017