public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a character: ");
char input = scanner.next().charAt(0);
if(input >= 'A' && input <='Z')
{
System.out.println(input + " is an Upper Case character.");
}
else if ( input >= 'a' && input <= 'z')
{
System.out.println(input + " is a Lower Case character.");
}
else if ( input >= '0' && input <= '9')
{
System.out.println(input + " is a Digit character. ");
}
else
{
System.out.println(input + " is a valid. is not Upper Case, Lower Case and Digit character.");
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter