- Data Types in Java:
Every variable in java has a data type. Data types specify the size and type of values that can be stored. Java language is rich in its data types. The varieties of data types available allow the programmer to select the type appropriate to the needs of the application. Data types in Java under various categories are shown in figure below.
- Size and Range:
Type
|
Size
|
Minimum Value
|
Maximum Value
|
Byte
|
One byte
|
-128
|
127
|
Short
|
Two bytes
|
-32,768
|
32,767
|
int
|
Four bytes
|
-2,147,483,648
|
2,147,483,647
|
long
|
Eight bytes
|
-9,223,372,036,854,775,808
|
9,223,372,036,854,775,807
|
float
|
Four bytes
|
3.4e-038
|
1.7e+0.38
|
double
|
Eight bytes
|
3.4e-038
|
1.7e+308
|
No comments:
Post a Comment