Data type is a keyword used to identify type of data. Data types in java are defined as specifiers that allocates space and type of values stored in the variable/identifiers. it has rich set of data type and are divided into two types. They are :
1. Primitive Data Types
2. Non-Primitive Data Types
- Primitive Data Type: They are 8 primitive data types and are divided into 3 types:
1. Numeric data type: It is used to represent numbers. And it is again divided into two types:
a) Integral data type: To represent whole numbers. They are
i. byte
ii. short
iii. int
iv. long
b) Floating point data types: To represent real number. They are
i. float
ii. double
2. char data type: It is used to represent characters.
3. boolean data type: It is used represent logical values. - Non-Primitive Data Type: These data types are user defined i.e., program contain their definition . It includes classes, array and interface string etc.,