Examveda
Examveda

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)

Answer: Option A


This Question Belongs to Java Program >> Strings

Join The Discussion

Related Questions on Strings