public class Boxing{
public static void main(
String[] args){
Boolean B1 = new Boolean(true);
Boolean B2 = new Boolean(true);
boolean b = true;
System.out.println("B1 == B2 : " + (B1 == B2));
System.out.println("B1 == b : " + (B1 == b));
System.out.println("B2 == b : " + (B2 == b));
}
}
-----
The result is:
false
true
true
-
Is it puzzling?
why B1==b and B2==b, but B1!=B2?
or in other
word, why B1!=B2, but B1==b and B2==b ?
Who could tell me why?
Thanks.
[ September 20, 2006: Message edited by: Ling Mike ]