Section
4 : Language Fundamentals
State the range of all primitive
data types and declare literal values for String and
all primitive types using all permitted formats,
bases, and representations.
Primitive data types
The char type ( 16 bit )
is integral but unsigned. If the most significant nine
bits of a char are all
zero, then the encoding is same as seven bit
ASCII.
Range of primitive types
Data Type |
Width |
Min. Value
|
Max. Value |
byte |
8 |
-128 |
127 |
short |
16 |
-32,768 |
32767 |
int |
32 |
-2,147,483,648 |
2,147,483,647 |
long |
64 |
-9,223,372,036,854,775,808 |
9,223,372,036,854,775,807 |
char |
16 |
0x0 (Unicode value) |
0xffff (Unicode value) |
float |
32 |
1.4012984643248170e-45 |
3.40282346638528860e+38 |
double |
64 |
4.94065645841246544e-324 |
1.79769313486231570e+308 |
Literals
char literals : A literal
representing a character is placed in single quotes
e.g. 'c'.
Integer literals : Any integer literal defaults to
int. To represent a
long value, the numerical
expression must contain either L or l as suffix.
Floating point literals : In order to be
interpreted as a floating point literal a numerical
expression must contain one of the following :
-
A decimal point.
-
The letter E or e : 55.21 E
-
The suffix F or f for float
-
The suffix D or d for double
A floating
point literal with no F or D suffix defaults to a 64
bit double literal.
String Literals
String literals are
represented in double quotes e.g. " Java ".
section4-1 | section4-2 | section4-3 | section4-4
Sections :
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|