Solution:
You got a nice question, man. It is easily can be founded in java whether the input is an uppercase or lowercase by calling a function name toUpperCase(). It returns a boolean type value, but I decided t write a code for you where we can check our input in various ways. Let’s do it.
public class UperCaseLowerCase
{
static void checker(char ch)
{
if (ch >= 'A' && ch <= 'Z')
System.out.println("\n" + ch +
" is an UpperCase character");
else if (ch >= 'a' && ch <= 'z')
System.out.println("\n" + ch +
" is a LowerCase character" );
else
System.out.println("\n" + ch +
" is not an aplphabetic character" );
}
public static void main(String []args)
{
char ch;
ch = 'A';
ch = 'a';
ch = '0';
checker(ch);
checker(ch);
checker(ch);
}
}
This program should throw back the output below:
A is an UpperCase character
a is a LowerCase character
0 is not an alphabetic character
Please reply to this thread if you have confusion regarding to this answer. Keep asking, please.
Thanks.