System.out.println(a[i] + " is a letter.");
if(Character.isWhitespace(a[i]))
System.out.println(a[i] + " is whitespace.");
if(Character.isUpperCase(a[i]))
System.out.println(a[i] + " is uppercase.");
if(Character.isLowerCase(a[i]))
System.out.println(a[i] + " is lowercase.");
}
}
}
The output from this program is shown here:
a is a letter.
a is lowercase.
b is a letter.
b is lowercase.
5 is a digit.
A is a letter.
A is uppercase.
is whitespace.
Chapter 16: Exploring java.lang 399
Method Description
static boolean isDefined(charch) Returnstrueifchis defined by Unicode.
Other wise, it returnsfalse.
static boolean isDigit(charch) Returnstrueifchis a digit. Other wise, it returns
false.
static boolean isIdentifierIgnorable(charch) Returnstrueifchshould be ignored in an
identifier. Other wise, it returnsfalse.
static boolean isISOControl(charch) Returnstrueifchis an ISO control character.
Other wise, it returnsfalse.
static boolean isJavaIdentifierPart(charch) Returnstrueifchis allowed as part of a Java
identifier (other than the first character).
Other wise, it returnsfalse.
static boolean isJavaIdentifierStart(charch) Returnstrueifchis allowed as the first character
of a Java identifier. Other wise, it returnsfalse.
static boolean isLetter(charch) Returnstrueifchis a letter. Other wise, it returns
false.
static boolean isLetterOrDigit(charch) Returnstrueifchis a letter or a digit. Other wise,
it returnsfalse.
static boolean isLowerCase(charch) Returnstrueifchis a lowercase letter. Other wise,
it returnsfalse.
TABLE 16-7 VariousCharacterMethods