Multiple choice technology programming languages

class C { 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)); }} What is the result of attempting to compile and run the program?

  1. Prints: false,false,false

  2. Prints: false,false,true

  3. Prints: true,false,false

  4. Prints: true,false,true

  5. Prints: true,true,true

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Boolean.valueOf(true) caches the Boolean.TRUE object, so b1==b2 returns true (same reference). The booleanValue() comparison also returns true. Boolean.valueOf is case-insensitive, so b3 and b4 are both TRUE and equals returns true. Output: true,true,true.