Data Type

Primitive Type vs Reference Type

8 Primitive Data Type
https://en.wikibooks.org/wiki/Java_Programming/Primitive_Types

boolean A binary value of either true or false
byte 8 bit signed value, values from -128 to 127
short 16 bit signed value, values from -32.768 to 32.767
char 16 bit Unicode character
int 32 bit signed value, values from -2.147.483.648 to 2.147.483.647
long 64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808
float 32 bit floating point value
double 64 bit floating point value

Object Types

Data type Description
Boolean A binary value of either true or false
Byte 8 bit signed value, values from -128 to 127
Short 16 bit signed value, values from -32.768 to 32.767
Character 16 bit Unicode character
Integer 32 bit signed value, values from -2.147.483.648 to 2.147.483.647
Long 64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808
Float 32 bit floating point value
Double 64 bit floating point value
String N byte Unicode string of textual data. Immutable

Reference Types

class A class is also a data type – a non primitive reference data type
interface An interface is a reference type in Java, it is similar to class, it is a collection of abstract methods.
array An array’s type is written as type[] , where type is the data type of the contained elements; arrays are objects, are dynamically created, and may be assigned to variables of type Object
enum An enum type is a special data type that enables for a variable to be a set of predefined constants.