Variables are used for storing data in memory during program execution.
Data Types
Depending on what data you need to store, there are several kinds of
data types. Java has eight types built into the language, called
primitives
. The integer (whole number) types are
byte,
short,
int, and
long. The
float and
double types represent floating-point numbers (real numbers). The
char type holds a Unicode character, and the
boolean type contains either a true or false value. Except for these primitive types, every other type in Java is represented by a class, an interface, or an array.