Variables and Types
Although Java is object
oriented, not all types are objects. It is built on top of basic variable types
called primitives.
Here is a list of all primitives in Java:
·
byte (number,
1 byte)
·
short (number,
2 bytes)
·
int (number,
4 bytes)
·
long (number,
8 bytes)
·
float (float
number, 4 bytes)
·
double (float
number, 8 bytes)
·
char (a
character, 2 bytes)
·
boolean (true
or false, 1 byte)
Java is a strong typed language, which means variables need to
be defined before we use them.