in the Mughal's mock exam:
The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?
A. char ch=65;
B. char ch='\65';
C. char ch='\0041';
D. char ch='A';
E. char ch="A";
My answer is: A, D. But the correct answer is only D.
WHY???
I compiled and run the following code:
public class child1
{
public static void main(
String[] args)
{
char c1=65;
char c2='A';
System.out.println(c1+" "+c2);
}
}
It prints "A A", as I expected.
Please explain me why the answer A is wrong???