LEXICAL STRUCTURE
Boolean Literals
3.10.3
See
Float.MIN_VALUE
( 20.9.1) and
Float.MAX_VALUE
( 20.9.2); see also
Double.MIN_VALUE
( 20.10.1) and
Double.MAX_VALUE
( 20.10.2).
A compile time error occurs if a nonzero floating point literal is too large, so
that on rounded conversion to its internal representation it becomes an IEEE 754
infinity. A Java program can represent infinities without producing a compile time
error by using constant expressions such as
1f/0f
or
1d/0d
or by using the pre
defined constants
POSITIVE_INFINITY
and
NEGATIVE_INFINITY
of the classes
Float
( 20.9) and
Double
( 20.10).
A compile time error occurs if a nonzero floating point literal is too small, so
that, on rounded conversion to its internal representation, it becomes a zero. A
compile time error does not occur if a nonzero floating point literal has a small
value that, on rounded conversion to its internal representation, becomes a non
zero denormalized number.
Predefined constants representing Not a Number values are defined in the
classes
Float
and
Double
as
Float.NaN
( 20.9.5) and
Double.NaN
( 20.10.5).
Examples of
float
literals:
1e1f
2.f
.3f
0f
3.14f
6.022137e+23f
Examples of
double
literals:
1e1
2.
.3
0.0
3.14
1e 9d
1e137
There is no provision for expressing floating point literals in other than deci
mal radix. However, method
intBitsToFloat
( 20.9.23) of class
Float
and
method
longBitsToDouble
( 20.10.22) of class
Double
provide a way to
express floating point values in terms of hexadecimal or octal integer literals. For
example, the value of:
Double.longBitsToDouble(0x400921FB54442D18L)
is equal to the value of
Math.PI
( 20.11.2).
3.10.3 Boolean Literals
The
boolean
type has two values, represented by the literals
true
and
false
,
formed from ASCII letters.
A
boolean literal
is always of type
boolean
.
BooleanLiteral: one of
true false
23
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved