Data in java programming language
Any information that is used in the program and has its place in the computer's memory is called the data.Data in Java can be categorized as simple or complex. Simple data types represent individual pieces of data, such as numbers or characters, while complex data types, known as objects, represent data structures composed of multiple simple data elements.
If a single number can fully describe the data in binary form, we refer to it as primitive data.
If we can not describe the data using a single number, we describe it by using several items that represent free data for themselves, then it is a complex information. Complex data is called objects.
Simple data
In order to reserve space in the memory for specific data, it must be known what kind of information is concerned, i.e. whether it's an integer or a decimal number, text or logical information (true-false). Therefore, each data has its own description (type) of the data.Program command: int a;
means to allocate the space in the memory for the integer data we call a.
Here int is the official word of the Java language and indicates the whole number, while the tag (name) of the data. The name of the data is also called the data identifier because it serves to "identify" a specific data. Here are some simple types of data used in Java with the value they occupy in the memory:
Data type in java
The table below shows the basic data types in Java, along with their descriptions and the amount of memory they occupy:
| Data type | Description | Memory[bit] |
|---|---|---|
| char | The integer data used for characters | 8 |
| short | Short integer data | 16 |
| int | Integer data | 32 |
| long | Long integer data | 64 |
| float | Real number in single precision | 32 |
| double | Real number in double precision | 64 |
| boolean | Logical data type (can be true or false) | 1 |
