Java Reference
In-Depth Information
Data Types
Integers
It includes whole valued signed numbers which are as follow.
Byte- Whose width is 8 and it ranges from -128 to 127. It is the smallest integer type. It is
useful when user is dealing with stream or flowing data from a network or a file.
Declaration of two byte variables called x and y is as follow
Byte x, y;
Short- The width of this type of integer is 16 and it ranges from -32,768 to 32,767. It is the
least commonly used data type in java.
Declaration
Short a;
Short b;
Int- The width of this type of integer is 32 and it ranges from -2,147,483,648 to
2,147,483,647. It is more efficient as compared to byte and short. It is commonly used to
control loops and indexed arrays.
Declaration
Int a;
Long- The width of this type of integer is 64 and it ranges from -9,223,372,036,854,775,808
to 9,223,372,036,854,775,807. This is used for those values which are large enough that the
integer cannot handle them.
Declaration
Int light speed;
Long days;
Long second;
Seconds = days *24 *60*60;
Floating point type
Search WWH ::




Custom Search