Top: Computers: Programming: Languages: Java: Syntax: Primitive Types




[ history ]

Primitive types are variables that can be used to store values. In Java, all primitive types have a predetermined size and format and is independent of the size and format used by the underlying platform.


[ history ]

boolean

This type can store one of two states. It is either "true" or "false".

The size of this type is 8 bits (1 byte).


[ history ]

byte

This type can store integers in the range -128 .. 127.

Numbers are stored in two's complement.

The size of this type is 8 bits (1 byte).


[ history ]

short

This type can store integers in the range -32768 .. 32767.

Numbers are stored in two's complement.

The size of this type is 16 bits (2 bytes).


[ history ]

int

This type can store integers in the range -2147483648 .. 2147483647.

Numbers are stored in two's complement.

The size of this type is 32 bits (4 bytes).


[ history ]

long

This type can store integers in the range -9223372036854775808l .. 9223372036854775807l.

Numbers are stored in two's complement.

The size of this type is 64 bits (8 bytes).


[ history ]

float

This type can store (real) numbers in the range 1.401298464324817-45 .. 3.402823466385288638.

Numbers are stored as IEEE 754 floating point numbers.

The size of this type is 32 bits (4 bytes).


[ history ]

double

This type can store (real) numbers in the range 4.9-324 .. 1.7976931348623157308.

Numbers are stored as IEEE 754 floating point numbers.

The size of this type is 64 bits (8 bytes).


[ history ]

char

This type can store a single character in the range \u0000 .. \uFFFF.

Characters are stored in Unicode.

The size of this type is 16 bits (2 bytes).



 All text is available under the terms of the GNU Free Documentation License. (See Copyright Policy for details.) 
© Open-Site Foundation, Inc.
Hosted by Android Technologies, Inc. the medical robotics news source.
Visit our sister sites dmoz.org | mozilla.org | chefmoz.org | musicmoz.org