public
boolean startsWith(String prefix)
Tests
if this string starts with the specified prefix. Returns true if the
string starts with given prefix, else false.
class StringStartsWith{ public static void main(String args[]){ String str = "Self Learning Java"; System.out.println(str.startsWith("Self")); System.out.println(str.startsWith("Abcd")); } }
Output
true false
No comments:
Post a Comment