The methods of Character wrapper class are discussed with the help of two programs. The first one, password check is explained with the help of isSpaceChar(), isDigit(), isLetter() methods. The second one, ToggleCase is explained with the help of isUpperCase(), toLowerCase(), isLowerCase() methods.
Link to the Book - Essentials of Computer Applications:
https://www.amazon.in/Essentials-Comp...
Link to the lesson 66 - toCharArray() method:
• Lesson 66 - Strings - Part 8 - replace (...
Link to the lesson 70:
• Lesson 70 - Strings - Part 12 - Encode-Dec...
Practice Exercise 74: Character wrapper class
Guess output:
1. char ch = ‘A’; boolean x = Character.isUpperCase(ch);
2. ch = ‘ ’; boolean x = Character.isSpaceChar(ch);
3. ch = ‘2’; boolean x = Character.isDigit(ch);
4. ch = ‘2’; boolean x = Character.isLetter(ch);
5. ch = ‘@’; boolean x = Character.isLetterOrDigit(ch);
6. ch = ‘a’; char x = Character.toUpperCase(ch);
7. ch = ’b’;
if(Character.isLetter(ch)==true)
System.out.println(“Between a-z or A-Z”);
else
System.out.println(“digit or a special character”);
8. ch=’@’;
if(Character.isLetterOrDigit(ch)!=true)
System.out.println(“Special character”);
else
System.out.println(“Not a special character”);