Computer Applications

Write a program that inputs a character and prints if the typed character is in uppercase or lowercase.

Java

Java Conditional Stmts

12 Likes

Answer

import java.util.Scanner;

public class KboatCheckCase
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter an alphabet: ");
        char ch = in.next().charAt(0);
        
        if(Character.isUpperCase(ch)) 
            System.out.println("Upper Case letter");
        else if(Character.isLowerCase(ch)) 
            System.out.println("Lower Case Letter");
        else
            System.out.println("Character not an alphabet");
    }
}

Variable Description Table

Program Explanation

Output

Answered By

3 Likes


Related Questions