34. JAVA Program To Learn how to read a character and finding uppercase or lowercase.
How does this program work?
- In this program your going to learn about how to scan a character.
- And How to Check the case of the letter
- Whether it is Lowercase or Uppercase.
Here is the code
// Uppercase or lowercase
import java.util.Scanner;public class letter
{
public static void main(String args[] )
{
char ch;
System.out.println("Enter a character");
Scanner sc = new Scanner(System.in);
ch = sc.next().charAt(0);
if(ch >= 65 && ch <= 90)
System.out.print("Upper Case Letter");
else
if(ch >= 97 && ch <= 122)
System.out.print("Lower Case Letter" );
else
System.out.println("\n" + ch +" is not an aplhabetic character" );
}
}