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
Write a program that inputs a number and tests if the given number is a multiple of both 3 and 5.
Write a program that inputs a character and prints if the user has typed a digit or an alphabet or a special character.
Write a program that inputs an alphabet and checks if the given alphabet is a vowel or not.
Find the error:
class Test { public static void main (String args[]) { int x = 10; if(x == 10) { int y = 20; System.out.println("x and y: "+ x +" "+ y); x = y * 2; } y = 100; System.out.println("x is"+ x); } }