Vidyalelo
Java Programming · Q13

Strings

Programming · Java Programming · question 13

Q13

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

A.
str.startsWith(prefix)
Answer
B.
str.beginsWith(prefix)
C.
str.starts(prefix)
D.
str.hasPrefix(prefix)

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board