Java String.contains() Method Example

The String.contains(CharSequence s) method returns true if and only if this string contains the specified sequence of char values.

Java String.contains() Method Example

public class ContainsExample {
    public static void main(String[] args) {
        String str = "javaguides";
        boolean contains = str.contains("guides");
        System.out.println("Contains : " + contains);

Contains: true 


Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course