Alphabate | ASCII value | Alphabate | ASCII value | Digit | ASCII value | ||
---|---|---|---|---|---|---|---|
Java code :
import java.util.*;
class ranjan
{
public static void main(String args[])
{
char ch = ' ';
Scanner sc=new Scanner(System.in);
System.out.print("Enter a character : ");
ch=sc.next().charAt(0);
if(ch>=65 && ch<=90)
{
System.out.println(ch+" is a Uppercase character");
}
else if(ch>=97 && ch<=122)
{
System.out.println(ch+" is a lowercase character");
}
else if(ch>=48 && ch<=57)
{
System.out.println(ch+" is a digit");
}
else
{
System.out.println(ch+" is a special character");
}
}
}
Output :
Enter a character : gg is a lowercase character
0 Comments