Friday, April 22, 2011

Limits and Size of the primary data types


Limits of the primary datatypes:

Data types Width (in bytes) Minimum value Maximum Value
byte 1 -27 27 - 1
short 2 -215 215-1
int 4 -231 231 - 1
long 8 -263 263 - 1
char 2 0x0 0xffff
float 4 1.401298e-45 3.402823e+38
double 8 4.940656e-324 1.797693e+308


So the sizes in bytes are:
byte - 1 B
short, char - 2B
int, float - 4 B
double, long - 8B

Also to get the limits through java we can get it by their wrapper classes. Click here to see how to get limits programatically.

No comments:

Post a Comment

Chitika