Package Practicego;import java.util.scanner;/* * 3. Enter a character to determine if the character is a number? English alphabet? or other character */public class Cto {public static void main (string[] args) {Scanner sc = new Scanner (system.in); System.out.println ("Enter a character:"); char ch = sc.next (). charAt (0); if (ch>=65 && ch<=90) {System.out.println ( Ch+ "is" + "capital Letter");} else if (ch>=97 && ch<=122) {System.out.println (ch+ "is" + "lowercase letter");} else if (ch>= ' 0 ' &&ch<= ' 9 ') {System.out.println (ch+ "is" + "number");} Else{system.out.println (ch+ "is" + "other Characters");}}}
Test:
Enter a character: 55 is a number
Enter a character: CC is uppercase
Enter a character: CC is a lowercase letter
Enter a character: ' is another character
Java Little exercise: Enter a character to determine if the character is a number? English alphabet? or other characters?