The Character class provides static functions to check if a character is upper case or lower case. Just call Character.isUpperCase or Character.isLowerCase.
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.println("Put in your letter");
char c = reader.next().charAt(0);
if (Character.isUpperCase); {
System.out.println("your letter is uppercase");
} if (Character.isLowerCase); {
System.out.println("Your letter is lowercase");
}
}
To check the letter for uppercase or lowercase you need to use the Character. Like for uppercase UpperCase(), method and similar to this for lowercase only change are LowerCase().
Ad
Advertisements
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.