Programming / Java

Java Primitive Data Types

by Libz
01 Jun 2016 at 22:43hrs | 2525 Views
Java programming language supports eight primitive data types. These are predefined by the Java language and their names reserved keyword. Primitive values do not share state with other primitive values. The eight primitive data types supported by the Java programming language are:

byte  // 8 bit, ranges from -128 to 127, Default Value 0
short // 16 bits, ranges from -2^15 to -2^15, Default Value 0
int // 32 bits, ranges from -2^31 to 2^31, Default Value 0
long // 64 bits, ranges from -2^63 to 2^63-1, Default value 0L

float  // 32 bits, Default value 0.0f
double // 64 bits, Default value 0.0d

boolean // 1 bit, two values: true or false, Default value false

char // 16 bits, only positive values, ranges from 0 to 65,535, Default value '\u0000'
All primitive data types are spelt in lowercase.
Source - docs.oracle.com



Chat Login

Register | Forgot password