In simple words, data type means which type of value a variable has. Basically, there are 8 data types.
- Boolean
- Char
- Byte
- Short
- Int
- Long
- Float
- Double
- The boolean data type is used to store true or false.
- A byte is a primitive data type and its value ranges from -128 to +127.
- char is a primitive data type and it can hold a single character.
- The short data type is a 16-bit signed two’s complement integer. The minimum value is -32768 and the maximum value is 32767.
- The int data type is a 32-bit signed two’s complement integer. The minimum value is -2^31 and the maximum value is 2^31-1.
- The float data type is a single-precision 32-bit IEEE 754 floating point. The float is used for decimal value.
- The long data type is a 64-bit two’s complement integer. The minimum value is -2^63 and the maximum value is 2^63-1.
- The double data type is a double-precision 64-bit IEEE 754 floating point. The value is unlimited for double.