Q. What is the correct way to check if a string starts with a specific prefix in Java?

  • (A) str.startsWith(prefix)
  • (B) str.beginsWith(prefix)
  • (C) str.starts(prefix)
  • (D) str.hasPrefix(prefix)
πŸ’¬ Discuss
βœ… Correct Answer: (A) str.startsWith(prefix)

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
116
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Vikash Gupta
Publisher
πŸ“ˆ
92%
Success Rate