Difference between == operator and equals() method

Difference between == operator and equals() method

  • ==: This == operator meant for address comparison.
  • .equals(): This .equals() method meant for contain comparison. Here java and JAVA is consider as different.
  • .equalsIgnoreCase(): This .equalsIgnoreCase() method meant for contain comparison but this ignore the case. JAVA and java will consider same.

Output:

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.