Java Data Types
Data types specify the size and type of values that can be stored. The variety of data types available allow the programmer to select the type appropriate to the needs of the application. Data type in Java can be classified as:
- Primitive types
- Reference types
Java has 8 primitive types: -
boolean
char
double
float
byte
int
short
long
Also Java has 3 reference types:
Class
Arrays
Interfaces
Primitive data types Interger
| Data type | Width(bits) | Minimum values | Maximum values |
|
Byte |
8 |
-27 (-128) |
27 -K+127) |
|
Short |
16 |
-215 (-32768) |
215-1 (+32767) |
|
Int |
32 |
-231 (-2147483648) |
231-1 (+2147483647) |
|
long |
64 |
-263(-223372036854 775808L) |
263-1-1 (+223372036854775807L) |
Characters
| Data type | Width(bits) | Minimum Unicode values | Maximum Unicode values |
|
char |
16 |
0X0 |
0Xffff |
The char data type encompasses all the 65536(216) characters in the Unicode character set as 16-bit values. The first 128-characters of the Unicode set the same as the 128 characters of the 7-bit ASCII character set, and the first 256 characters of the Unicode set correspond to the 256 characters of the 8-bit ISO Latin-1 character set.
Floating-point numbers
| Data type | Width(bits) | Minimum values | Maximum values |
|
Float |
32 |
1.40129846432481707e-45 |
340282346638528860e+38 |
| double | 64 | 4.94065645841246544e-324 | 1.779769313486231570e+308 |
Boolean
| Data type | Width(bits) | Value |
| Boolean | 1bit | True/False |
The Boolean data type is used to represent logical values that can be either the literal true or the literal false.
Boolean values are returned by all relational, conditional and boolean logical operators and are primarily used to govern the flow of control during program execution.
Boolean values cannot be converted to other primitive data values and vice versa.
- Tutorial:

Comments
Preparaty na odchudzanie
Chcesz szybko schudnac bez wysilku ? Sprawdz najlepsze na rynku Skuteczne odchudzanie
Minus 8 kg w miesiac !