10.
char ch= Y.
char chr = Character to LowerCase(ch);
int p= (int)chr;
System.out.println(chr+ " \t” +p); what is the output for the following
Answers
Answer:
_________________
output:
y 119
Answer:
import java .util.Scanner;
class char_type
{
public static void main (String args[])
{
Scanner in = new Scanner(System.in);
char chr;
System.out.println("Enter a character");
chr=in.next().charAt(0);
if(Character.isLetter(chr)==true)
{
if(Character.isUpperCase(chr)==true)
System.out.println(chr+"is an upper case character");
if(Character.isLowerCase(chr)==true)
System.out.println(chr + "is a lower case character");
}
else
{
if(Character.isDigit(chr)==true)
System.out.println(chr+"is a digit");
else
System.out.println(chr+"is a special character");
}
}
}
Explanation: