Java defines four integer types: byte, short, int, and long, which are shown here:
Type Width in Bits Range
byte 8 –128 to 127
short 16 –32,768 to 32,767
int 32 –2,147,483,648 to 2,147,483,647
long 64 –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
As the table shows, all of the integer types are signed positive and negative values.
Java does not support unsigned (positive-only) integers.
Many other computer languages support both signed and unsigned integers.
However, Java’s designers felt that unsigned integers were unnecessary.
No comments:
Post a Comment