What are the primitive data types in java
Variables are required to store the data. Internally, a variable represents the memory location which holds the data. To use a variable in our program, first we should declare which type of data is to be store into that variable .
Integer Data Types :
byte : The byte data type is an 8-bit signed two’s complement integer with minimum value -128 and maximum value 127.
short : The short data type is a 16-bit signed two’s complement integer with minimum value of -32,768 and a maximum value of 32,767.
int : The int data type is a 32-bit signed two’s complement integer with minimum value of -2,147, 483,648 and a maximum value of 2,147,483,647.
long : The long data type is a 64-bit signed two’s complement integer with minimum value of -9,223, 372 , 036, 854, 775, 808 and a maximum value of 9,223,372,036,854,775,807.
Float Data Types:
float : The float data type is a single-precision 32-bit IEEE 754 floating point with -3.x to -1.4e-45 for .-ve values and 1.4e-45 to 3.4e38 for +ve values.
double: The double data type is a double-precision 64-bit IEEE 754 floating point with -1.8e308 to -4.9e-324 for -ve values and 4.9e-324 to 1.8e308 for +ve values.
char Data Types:
char : The char primitive data type is a single 16-bit Unicode character with minimum value 0 and maximum value 65535.
Boolean Data Types:
boolean : The boolean primitive data type has only two possible values: true and false and represents one bit of information.
java supports, the above 8 Data Types .
Java programming language also provides special support for character strings via the java.lang.String.
The String class is not technically a primitive data type, but considering the special support given to it by the language.
|Related Posts :|
|Character and boolean primitive data types in java|
|What are the primitive Integer and Floating-Point Data Types in java|