JAVA Data Types
Java has a number of data types below is the complete list of them . Although syntax of Java is largely derived from C++ but datatypes are a bit different from C for example C does not have Boolean data type. Java Datatypes have a fixed size and also some default values that will bet set to variables if they are declared but not initialized.
- Boolean : Boolean datatype does not have a specific size declared but conceptually it has one bit value. Boolean datatypes has only two possible values true or false. Default value for Booleans are false.Size:- not definedValues:- true or falseDefault value:- false
- Char: A char is 16 bit value that can be treated like an integer value but is intended to hold characters. In a Java program a char datatype is always interpreted as a numeric value of a displayable character.Size:- 16 bitValues:- from 0 to 65535Default value:- 0
- Byte: A byte is an 8 bit integer value.Size:- 8 bitValues:- from -128 to 127Default value:- 0
- Sort: A sort is an 16 bit integer value.Size:- 16 bitValues:- from -32768 to 32767Default value:- 0
- Int: A int is an 32 bit integer value.Size:- 32 bitValues:- from -2147483648 to 2147483647Default value:- 0
- long: A Long is an 64 bit integer value and it is the largest of all the integer types.Size:- 64 bitValues:- from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Default value:- 0
- float: A float is 32 bit single precision floating point decimal number.Size:- 32 bitValues:- from -1.4E-45 to 3.4028235E38Default value:- 0.0
- double: Double is 64 bit double precision floating point decimal number.Size:- 64 bitValues:- from -4.9E-324 to 1.7976931348623157E308Default value:- 0.0