Enter a character string on the keyboard to traverse each character in the string. If the character is a lowercase letter, the output "this character is a lowercase letter" is displayed. If the character is an uppercase letter, the output "this character is an uppercase letter"; otherwise, the output "this character is not a letter ".
Code entry:
Import java. io. *; public class Practice {public static void main (String [] args) {// TODO Auto-generated method stubBufferedReader buf; buf = new BufferedReader (new InputStreamReader (System. in); try {String str = buf. readLine (); for (int I = 0; I <str. length (); I ++) {char ch = str. charAt (I); // System. out. println (ch); if (! Character. isLetter (ch) {System. out. println ("this Character is not a letter");} else if (Character. isLetter (ch) {if (! Character. isLowerCase (ch) {System. out. println ("this Character is an uppercase letter");} else if (Character. isLowerCase (ch) {System. out. println ("this character is a lowercase letter") ;}}} catch (Exception e ){}}}
Effect: