Java Reference
In-Depth Information
•
static boolean isUpperCase(char ch)
returnstruewhen
ch
con-
tains an uppercase letter.
•
static boolean isWhitespace(char ch)
returns true when
ch
contains a whitespace character (typically a space, a horizontal tab, a carriage
return, or a line feed).
•
static char toLowerCase(char ch)
returnsthelowercaseequival-
ent of
ch
's uppercase letter; otherwise, this method returns
ch
's value.
•
static char toUpperCase(char ch)
returnstheuppercaseequival-
ent of
ch
's lowercase letter; otherwise, this method returns
ch
's value.
Forexample,
isDigit(ch)
ispreferableto
ch >= '0' && ch <= '9'
be-
causeitavoidsasourceofbugs,ismorereadable,andreturnstruefornon-Latindigits
(e.g.,
'\u0beb'
) as well as Latin digits.
Float and Double
Float
and
Double
storefloating-pointanddoubleprecisionfloating-pointvaluesin
Float
and
Double
objects, respectively. These classes declare the following con-
stants:
•
MAX_VALUE
identifiesthemaximumvaluethatcanberepresentedasa
float
or
double
.
•
MIN_VALUE
identifiestheminimumvaluethatcanberepresentedasa
float
or
double
.
•
NaN
represents
0.0F/0.0F
as a
float
and
0.0/0.0
as a
double
.
•
NEGATIVE_INFINITY
represents -infinity as a
float
or
double
.
•
POSITIVE_INFINITY
represents +infinity as a
float
or
double
.
Float
and
Double
alsodeclarethefollowingconstructorsforinitializingtheirob-
jects:
•
Float(float value)
initializes the
Float
object to
value
.
•
Float(double value)
initializes the
Float
object to the
float
equi-
valent of
value
.
•
Float(String s)
converts
s
'stexttoafloating-pointvalueandstoresthis
value in the
Float
object.
•
Double(double value)
initializes the
Double
object to
value
.