36. JAVA Program To Check the Given Character is Lowercase or Uppercase or Sepecial Character.
How does this program work?
- This code used to find biggest of two numbers.
- Here we take two variables to store two numbers.
- Here we compare the two numbers using swich case.
Here is the code
// To check the character uppercase or lowercase or digit or special case using if case.
import java.util.Scanner;public class character
{
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 alphabet");
}
else
if(ch >= 97 && ch <= 122)
{
System.out.print( "Lower case alphabet");
}
else
if(ch >= 48 && ch <= 57)
{
System.out.print( "Digit" +ch);
}
else
System.out.print( "Special Characters");
}
}