Question 51.
Select the code segments(assuming is part of valid class) below that compile and run correctly with output: We are Equal
A.int i = 10;
long l = 10L;
if( i == l )
System.out.println("We are Equal");
B.int i = 10;
Integer ii = new Integer(10);
if( i == ii)
System.out.println("We are Equal");
C.int i = 10; char c = 10;
if( c == i)
System.out.println("We are Equal");
D.Integer ii = new Integer(10);
Integer jj = new Integer(10);
if(ii == jj)
System.out.println("We are Equal");
E.String s1 = "Null";
String s2 = "Null";
if( s1 == s2)
System.out.println("We are Equal");
F.String s1 = "Null";
String s2 = new String(s1);
if( s1 == s2)
System.out.println("We are Equal");
//I LIKED A AND E, BUT C IS ALSO CORRECT, HOW COME ?
IS IT BECAUSE OF THE NUMERIC PROMOTION DUE TO BINARY OPERATION ?