Multiple choice

Which of the following is not a valid statement in Java?

  1. str1.equalsIgnoreCase(str2)

  2. str1.equalsIgnoreCase()

  3. “Hello”.equalsIgnoreCase(“hello”)

  4. str1.equals(str2)

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

All are valid statements except str1.equalsIgnoreCase() because at least one parameter is required of string type.