There are no items in your cart
Add More
Add More
Item Details | Price |
---|
Java String Tutorial
Fri Jan 14, 2022
contains()
contains() method searches the sequence of characters not char in the string. It returns true if the sequence of char is found in this string otherwise returns false.
Example:
String S1="Welcome";
System.out.println(S1.contains("c"));
System.out.println(S1.contains("elc"));
System.out.println(S1.contains("elo"));
Output:
true
true
false
endsWith()
endsWith() method checks if this string ends with a given suffix. It returns true if this string ends with the given suffix; else returns false.
String S1="Welcome";
System.out.println(S1.endsWith("e"));
System.out.println(S1.endsWith("m"));
System.out.println(S1.endsWith("me"));
Output:
true
false
true
S P SHARMA CLASSES
S P SHARMA SIR