Java programming language stats that all the variables
must be declared first and then to be used. Java support eight types of
primitive data types.
Primitive data types are the data types already defined in Java. Following are the eight primitive data types:
int: it is used for integer type values It is a 32-bit signed two's complement integer that ranges from -2,147,483,648 to 2,147,483,647. For wider range of integer type values we use long.
byte: it is used for byte type values It is a 8-bit signed two's complement integer that ranges from -128 to127 (inclusive). Generally it is used to save memory in large arrays and to increase the limit of the code.
short: short is a 16-bit signed two's complement integer data type that ranges from -32,768 to 32,767. It saves the memory in large arrays.
long: long is a 64-bit signed two's complement integer data type that ranges from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. This data type is used for large range of values.
float: float is a single-precision 32-bit IEEE 754 floating point that ranges from 1.40129846432481707e-45 to 3.40282346638528860e+38 (positive or negative). This data type is not used if the exact values are required such as currency.
double: It is a double-precision 64-bit IEEE 754 floating point, ranges from 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative).
boolean: It is 1-bit long having only two values: true and false. It is mainly used in conditional statements.
char: char is a single 16-bit, unsigned data type and ranges from 0 to 65,535.
To know more about Java Data Types click on the link
Posted on: April 3, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles