Comparition of String variables in Java

Question:
String variables a and b are correctly compared in this expression:

  1. a == b
  2. a.equals(b)
  3. a.length() == b.length()
  4. a.toUpperCase() == b.toUpperCase()
Answer:
B - is the correct answer