Which method of the String class is used to compare two strings for equality, ignoring case differences?

  • compareTo()
  • compareToIgnoreCase()
  • equals()
  • equalsIgnoreCase()
In Java, the equalsIgnoreCase() method of the String class is used to compare two strings for equality while ignoring differences in case. It returns true if the two strings are equal, regardless of whether the characters are in uppercase or lowercase. The other options, equals(), compareToIgnoreCase(), and compareTo(), do not perform case-insensitive comparisons.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *