Java Overview – Lesson 3 – Data Type
As I have mentioned in the previous lesson, the data type represents the variable size in the memory.
You should choose the right data type for the variable to improve the application performance
and prevent the overuse of the resources.
Here is the data type list in Java
1. Primitive Data Types:
– byte: 8-bit integer ranging from -128 to 127.
– short: 16-bit integer ranging from -32,768 to 32,767.
– int: 32-bit integer ranging from -2,147,483,648 to 2,147,483,647.
– long: 64-bit integer ranging from -2,147,483,648 to 2,147,483,647.
– float: 32-bit floating-point number.
– double: 64-bit floating-point number.
– boolean: represents either true or false.
– char: 16-bit Unicode character.
2. Reference Data Types:
– Arrays: collection of elements of the same type.ja
– Classes: user-defined data types.
– Strings: sequences of characters.
We can split the data type into 3 main categories.
Letters and sentences, Numbers, Booleans