Data type is nothing but the type of the data. Each Variable in Java must have certain type associated with it which tells us what kind of data a variable can store.
Data Types in Java Programming Language are classified into two main groups – Primitive and Reference Data Types.
A primitive Data Types are :
- Data types are predefined by the Java language.
- Predefined data types are Reserved keyword so we cannot use them as variable name inside program/application
- Primitive values do not share state with other primitive values.
- Total Number of Primitive Data Types in Java Programming is 8
- All Primitive Data Types have respective Wrapper Classes i.e Integer is wrapper class for primitive type int
Primitive Data Types are –
Primitive Data Types in Java : |
|
|
|
boolean |
char |
byte |
int |
short |
long |
float |
double |
Classification of Data Types in Java Programming Language
Data Type and Other Details
Type |
Contains |
Default |
Size |
boolean |
true or false |
false |
1 bit |
char |
Unicode Character |
u0000 |
16 bits |
byte |
Signed Integer |
0 |
8 bits |
short |
Signed Integer |
0 |
16 bits |
int |
Signed Integer |
0 |
32 bits |
long |
Signed Integer |
0 |
64 bits |
float |
Floating Number |
0.0 |
32 bit |
double |
Floating Number |
0.0 |
64 bit |