Bird
0
0

Which of the following is the correct way to check if a string s starts with "Java"?

easy📝 Syntax Q3 of 15
Java - Strings and String Handling
Which of the following is the correct way to check if a string s starts with "Java"?
As.startsWith("Java")
Bs.startWith("Java")
Cs.starts_with("Java")
Ds.startswith("Java")
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct method name

    The correct method is startsWith with capital W.
  2. Step 2: Check syntax correctness

    Options B, C, and D have incorrect method names or casing.
  3. Final Answer:

    s.startsWith("Java") -> Option A
  4. Quick Check:

    Correct method is startsWith() with capital W [OK]
Quick Trick: Use startsWith() with capital W to check prefix [OK]
Common Mistakes:
  • Misspelling method name
  • Wrong casing in method name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes