Java Reference
In-Depth Information
14
.
The
int
data type is used to represent integers between
2147483648
(=
2
31
) and 2147483647 = (2
31
1). The memory allocated for the
int
data type is 4 bytes.
15
.
The data type
short
is used to represent integers between
32768
(=
2
15
) and 32767 (2
15
1). The memory allocated for the
short
data
type is 2 bytes.
16
.
Java uses the Unicode character set, which is a set of 65536 characters. The
ASCII character set, which has 128 values, is a subset of Unicode. The first
128 characters of Unicode, 0-127, are the same as those of ASCII.
17
.
The collating sequence of a character is its preset number in the Unicode
character data set.
18
.
The data types
float
and
double
are used to deal with floating-point
numbers.
19
.
The data type
float
can be used in Java to represent any real number
between
3.4E+38 and 3.4E+38. The memory allocated for the
float
data type is 4 bytes.
20
.
The data type
double
can be used in Java to represent any real number
between
1.7E+308 and 1.7E+308. The memory allocated for
2
the
double
data type is 8 bytes.
21
.
The maximum number of significant digits—that is, the number of decimal
places—in
float
values is 6 or 7. The maximum number of significant
digits in values belonging to the
double
type is 15. The maximum number
of significant digits is called the precision.
22
.
Values of type
float
are called single precision, and values of type
double
are called double precision.
23
.
The arithmetic operators in Java are addition (
+
), subtraction (
-
), multi-
plication (
*
), division (
/
), and mod (
%
).
24
.
The mod operator,
%
, gives the remainder upon division.
25
.
All operands in an integral expression, or integer expression, are integers,
and all operands in a floating-point expression are decimal numbers.
26
.
A mixed expression is an expression that consists of both integers and
decimal numbers.
27
.
When evaluating an operator in an expression, an integer is treated as a
floating-point number, with a decimal part of zero, only if the operator has
mixed operands.
28
.
You can use the cast operator to explicitly treat values of one data type as
another.
29
.
The
class
String
is used to manipulate strings.
30
.
A string is a sequence of zero or more characters.
31
.
Strings in Java are enclosed in double quotation marks.
32
.
A string containing no characters is called a null or empty string.
Search WWH ::
Custom Search