Hi All,
public class A
{
public static void main(
String[] args)
{
byte x=2;
switch(x)
{
case 'b': //1 // Here should be the problem.
default : // 2
case -2: // 3
case 80: // 4
}
}
}
// As we need casting 2 convert byte to char or char to byte,
//I thought that Line 1 should give error.But,it is not giving any error.
//Line //1 does not compile on JDK1.2 but it does work on 1.3!...why??
another problem:
-----
System.out.println(null + true); //1
System.out.println(true + null); //2
System.out.println(null + null); //3
Line //1 and //2 and //3 will not compile on JDK1.2 but work on 1.3!
NOw..My q. is what should be the answer in the real Exam for the above two ?
If they give 2 options like:
a. It will Compile.
b.It will not compile.
should I say a or b !!!
THANKS IN ADVANCE.
Ratul Banerjee