Data Types in JAVA.
Data Types in JAVA
- It is a type of data which is used in the program.
- There are many predefined data types in java library like int,char,float etc.
Type of Data Type

Primitive Data Type
- The data type which is predefined in the library is called primitive data type.
- It is named by a keyword for example int,float,char etc.
- There are eight primitive data types in java.
byte, short, int, long, float, double, boolean and char.
Integer Type
| Type | Size in bytes | Range |
| byte | 1 | -128 to 127 |
| short | 2 | -32,768 to 32,767 |
| int | 4 | -2,147,483,648 to 2,147,483,647 |
| long | 8 | -9,223,372,036,854,775,808 to 9,223.372,036,854,775,808 |
Float Type
| Type | Size in bytes | Range |
| float | 4 | 3.4e-038 to 3.4e+038. |
| double | 8 | 1.7e-308 to 1.7e+038. |
Boolean
| Keyword | boolean |
| Syntax | boolean x; |
| Value | True/False |
| Default | False |
Character
| Keyword | char |
| Syntax | char x; |
| Value | 'a','@','9' |
| Range | 0 to 65536 |
Non-primitive Data Type
- The data type which is derived from primitive data type is called non-primitive data type.
- It is also called reference data type.
- They don't store the value, but store a reference to that value.
- Example:Array,class,interface etc.