Data type define size a variable, the operating system allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals, or characters in these variables.
1. Primitive Data Types
2. Reference/Object Data Types
There are eight primitive datatypes supported by Java. Primitive datatypes are predefined by the language and named by a keyword. Let us now look into the eight primitive data types in detail.
|Data Type||Default Value||Default size|
|byte||0 1||1 byte|
A reference variable is used to refer any object of a class.
← Previous Next →
Animal animal = new Animal("giraffe");
© 2018 BreakInerview