Java Reference
In-Depth Information
Enter a character and press Enter
8
is defined: true
is digit: true
is first character in a Java identifier: false
is part of a Java identifier: true
is letter: false
is letter or digit: true
is lower case: false
is upper case: false
to upper case: 8
to lower case: 8
Enter a character and press Enter
$
is defined: true
is digit: false
is first character in a Java identifier: true
is part of a Java identifier: true
is letter: false
is letter or digit: false
is lower case: false
is upper case: false
to upper case: $
to lower case: $
Fig. 14.15
|
Character
static
methods for testing characters and converting case. (Part 2 of 2.)
Line 15 uses
Character
method
isDefined
to determine whether character
c
is
defined in the Unicode character set. If so, the method returns
true
; otherwise, it returns
false
. Line 16 uses
Character
method
isDigit
to determine whether character
c
is a
defined Unicode digit. If so, the method returns
true
, and otherwise,
false
.
Line 18 uses
Character
method
isJavaIdentifierStart
to determine whether
c
is
a character that can be the first character of an identifier in Java—that is, a letter, an under-
score (
_
) or a dollar sign (
$
). If so, the method returns
true
, and otherwise,
false
. Line
20 uses
Character
method
isJavaIdentifierPart
to determine whether character
c
is a
character that can be used in an identifier in Java—that is, a digit, a letter, an underscore
(
_
) or a dollar sign (
$
). If so, the method returns
true
, and otherwise,
false
.
Line 21 uses
Character
method
isLetter
to determine whether character
c
is a letter.
If so, the method returns
true
, and otherwise,
false
. Line 23 uses
Character
method
isLetterOrDigit
to determine whether character
c
is a letter or a digit. If so, the method
returns
true
, and otherwise,
false
.
Line 25 uses
Character
method
isLowerCase
to determine whether character
c
is a
lowercase letter. If so, the method returns
true
, and otherwise,
false
. Line 27 uses
Char-
acter
method
isUpperCase
to determine whether character
c
is an uppercase letter. If so,
the method returns
true
, and otherwise,
false
.
Line 29 uses
Character
method
toUpperCase
to convert the character
c
to its upper-
case equivalent. The method returns the converted character if the character has an upper-