A variable is a request for memory to store a value. In other words, when creating a variable, you need to request space in memory.
The memory management system allocates storage space for variables based on the type of the variable, and the allocated space can only be used to store that type of data.
Therefore, you can store integers, decimals, or characters in memory by defining variables of different types.
Two big data types for Java:
(i). Built-in data type (base data type)
16 Types of numbers (byte, short, int, long, float, double) + void
8 16 32 64 32 64 bit
21 Character Types Char
16-bit Unicode characters
31 BOOL Boolean types
1 guests
(ii). Reference data type
Reference type variables are created by the constructors of the classes and can be used to access the referenced objects. These variables are specified as a specific type at the time of declaration. Once a variable is declared, the type cannot be changed.
objects, arrays are reference data types, and the default values for all reference types are null.
The base data type can only be passed by value, while the encapsulated class is passed by reference.
void no return value type, as an object of the pseudo-type corresponding class, is also considered to be the basic data type
Basic data types in Java and encapsulation classes