Bird
0
0

What does the expression "Java".equalsIgnoreCase("java") return?

easy📝 Conceptual Q2 of 15
Java - Strings and String Handling
What does the expression "Java".equalsIgnoreCase("java") return?
Atrue
Bfalse
Cnull
DThrows an exception
Step-by-Step Solution
Solution:
  1. Step 1: Understand equalsIgnoreCase method

    This method compares two strings ignoring case differences.
  2. Step 2: Apply to given strings

    "Java" and "java" differ only in case, so equalsIgnoreCase returns true.
  3. Final Answer:

    true -> Option A
  4. Quick Check:

    equalsIgnoreCase ignores case = true [OK]
Quick Trick: Use equalsIgnoreCase() to ignore case differences [OK]
Common Mistakes:
  • Expecting false due to case difference
  • Using == instead of equalsIgnoreCase
  • Confusing with equals()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes