Create a program to display whether the entered character is in uppercase or lowercase.

Create a program to display whether the entered character is in uppercase or lowercase.

public class KboatLetterCheck
{
    public static void checkLetter(char ch) {
        System.out.println("Entered character: " + ch);
        if (ch >= 65 && ch <= 90)
            System.out.println("Uppercase");
        else if (ch >= 97 && ch <= 122)
            System.out.println("Lowercase");
        else
            System.out.println("Not a letter");
    }
}
Output

BlueJ output of KboatLetterCheck.java

 

Comments