public class StringPractice { public static void main (String [] args) { // Create a text scanner Scanner SC = new new Scanner (the System. in ); the System. OUT .println ( " Enter a string: " ); String STR = sc.next (); // define three variable used to count the uppercase letters, lowercase letters, numbers, number int bigCount = 0 ; int smallCount = 0 ; int numCount = 0 ; // traversal string, each character judgment for (int i = 0;i<str.length();i++){ char chs = str.charAt(i); //如果 if (chs >= 'A' && chs <= 'Z'){ bigCount++; }else if (chs >= 'a' && chs <= 'z'){ smallCount++; }else if (chs >= '0'CHS && <= ' . 9 ' ) { numCount ++ ; } the else { the System. OUT .println ( " the character " + CHS + " illicit " ); } } // output of the System. OUT .println ( " uppercase characters: " bigCount + + " a " ); System. OUT .println ( " lowercase characters: " + + smallCount "More "); The System. OUT .println ( " numeric characters: " + numCount + " a " ); } }