posted 18 years ago
Hi,
This is a simple question from Dan's exam.
Boolean b1 = new Boolean(true);
Boolean b2 = new Boolean(true);
Boolean b3 = new Boolean("TrUe");
Boolean b4 = new Boolean("tRuE");
System.out.print((b1==b2) + ","); //1
System.out.print((b1.booleanValue()==b2.booleanValue()) + ",");//2
System.out.println(b3.equals(b4));
Ths ans given is : false,true,true
My doubt is in the line #2. It seems to be v..simple but i am getting confused. When ohjects are not equal(line #1), how can the value be the equal in (line#2) .
Pl. explain this.
-Sanjana