Multiple choice technology programming languages

class H { public static void main (String[] args) { String s1 = "HHH"; StringBuffer sb2 = new StringBuffer(s1); System.out.print(sb2.equals(s1) + "," + s1.equals(sb2)); }}

  1. Prints: false,false

  2. Prints: true,false

  3. Prints: false,true

  4. Prints: true,true

  5. None of the above

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

StringBuffer's equals() method compares object references (inherited from Object), not content. So sb2.equals(s1) returns false because they're different objects. String's equals() compares content, but it only returns true when comparing with another String, so s1.equals(sb2) returns false. Output is false,false. Option A is correct.