Wednesday, 1 August 2007

Java Language Fundamentals (Part 4)

Java Language Fundamentals (Part 4)


Data Types


All variables in the Java language must have a data type. A variable's data type determines the values that the variable can contain and the operations that can be performed on it. For example, the declaration


int value

declares that

value
is an integer (
int
).

There are two major categories of data types in the Java language: primitive and reference. The following table lists, by keyword, all of the primitive data types supported by Java:


















































Data Type



Description



Integral type




byte



Values from –128 to +127



short



Values from –32768 to +32767



int



Values from –21474883648 to +2147483647



long



Values from –9223372036854775808 to
+9223372036854775807



Floating type




float



Values from –3.4E38 to +3.4E38



double



Values from –1.7E308 to +1.7E308



textual




char


logical



Stores single character (16-bit Unicode character)



boolean



Can have one of two values (true or false)


No comments: