Hi, I got it from
http://www.danchisholm.net/july21/topic/section8/wrapper2ans.html class Boo
{
public static void main(
String args[])
{
Boolean b1 = Boolean.valueOf(true);
Boolean b2 = Boolean.valueOf(true);
Boolean b3 = Boolean.valueOf("TrUe");
Boolean b4 = Boolean.valueOf("tRuE");
System.out.print((b1==b2) + ",");
System.out.print((b1.booleanValue()==b2.booleanValue()) + ",");
System.out.println(b3.equals(b4));
System.out.println(b3==b4);
}
}
output is true,true,true.
I thought the answer would be false,true,false. Since the valueOf() returns newly createdobject of the type that invoked the method.
please explain me this comes true...
thanks in advance
Preparing
Scjp 1.5