Multiple choice java

What happens when you do if (a==b)?

Integer a = new Integer(2);
 Integer b = new Integer(2); 

  1. Compiler error

  2. Runtime Exception

  3. FALSE

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

When comparing two Integer objects created with 'new Integer(2)', the == operator compares object references (memory addresses), not values. Since a and b are different objects, a==b returns FALSE. To compare Integer values, use .equals() method.