Multiple choice

Which of the following statements about equals() method and '==' operator in java is correct?

  1. The method and the operator perform the same operation.

  2. The method and the operator perform different operations.

  3. There is no equals() method supported by java.

  4. None of these

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

The equals() method is used to compare two strings whereas '==' operator is to compare two object references.