5) Write a program in java to check whether the entered character is alphabet, digit or space character. If it is alphabet then print whether it is capital or small alphabet. Also change the alphabet into the reverse case.


import java.io.*;
class Check
{

public static void main(String args[]) throws IOException
{
char ch;
BufferedReader inputstream =new BufferedReader(new InputStreamReader(System.in));

System.out.println(“Enter Any Character:-”);

ch=(char) inputstream.read();

if(Character.isDigit(ch))
System.out.println(“Entered Character is Digit”);
else if(Character.isUpperCase(ch))
{
System.out.println(“Entered Character is Upper case”);
System.out.println(“Lower Case Character is:-”+Character.toLowerCase(ch));
}
else if(Character.isLowerCase(ch))
{
System.out.println(“Entered Character is Lower Case”);
System.out.println(“Upper Case Character is:-”+Character.toUpperCase(ch));
}
else
System.out.println(“Entered Character is special char”);
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s