The Boolean literal false is autoboxed to a1 and a2, and boxed to b1 and b2. What would be the result of a1 == a2
? Before you dismiss this question as something trivial, think about what would be the result of b1 == b2
?
// Autobox
Boolean a1 = false;
Boolean a2 = false;
//Box
Boolean b1 = new Boolean(false);
Boolean b2 = new Boolean(false);
System.out.println(a1 == a2); // ?
System.out.println(b1 == b2); // ?
What would be the output of above?