Java Reference
In-Depth Information
Primitive Types
A primitive type isatypethatisdefinedbythelanguageandwhosevaluesarenotob-
jects.JavasupportstheBoolean,character,byteinteger,shortinteger,integer,longin-
teger, floating-point, and double precision floating-point primitive types. They are de-
scribed in Table 1-1 .
Table1-1 describeseachprimitivetypeintermsofitsreservedword,size,minimum
value,andmaximumvalue.A“--”entryindicatesthatthecolumninwhichitappearsis
not applicable to the primitive type described in that entry's row.
The size column identifies the size of each primitive type in terms of the number
of bits (binary digits—each digit is either 0 or 1) that a value of that type occupies in
memory. Except for Boolean (whose size is implementation dependent—one Java im-
plementation might store a Boolean value in a single bit, whereas another implement-
ationmightrequireaneight-bit byte forperformanceefficiency),eachprimitivetype's
implementation has a specific size.
The minimum value and maximum value columns identify the smallest and largest
valuesthatcanberepresentedbyeachtype.ExceptforBoolean(whoseonlyvaluesare
true and false), each primitive type has a minimum value and a maximum value.
Theminimumandmaximumvaluesofthecharactertypereferto Unicode ,whichis
a standard for the consistent encoding, representation, and handling of text expressed
inmostoftheworld'swritingsystems.Unicodewasdevelopedinconjunctionwiththe
Universal Character Set , a standard for encoding the various symbols making up the
 
Search WWH ::




Custom Search