-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCharacterClass.java
21 lines (18 loc) · 1.01 KB
/
CharacterClass.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Understanding "Character Class" in Java
public class CharacterClass {
public static void main(String[] args) {
Character a = new Character('A');
Character b = new Character('B');
Character c = new Character('5');
Character d = new Character('$');
System.out.println("Is 'a' a letter? " + Character.isLetter(a));
System.out.println("Is 'a' a digit? " + Character.isDigit(a));
System.out.println("Is 'a' a whitespace? " + Character.isWhitespace(a));
System.out.println("Is 'a' uppercase? " + Character.isUpperCase(a));
System.out.println("Is 'a' lowercase? " + Character.isLowerCase(a));
System.out.println("Is 'a' a letter or digit? " + Character.isLetterOrDigit(a));
System.out.println("Is 'c' a letter or digit? " + Character.isLetterOrDigit(c));
System.out.println("Is 'd' a letter or digit? " + Character.isLetterOrDigit(d));
System.out.println("Is 'b' a letter or digit? " + Character.isLetterOrDigit(b));
}
}