Java string contains() is an inbuilt method that was introduced in Java 1.5 release and it is used to find the sequence of characters in a given string. If that sequence is found it returns true, otherwise it returns false.  Java String contains() function is used to check if the string contains the particular character sequence or not.

Java String Contains Example

Java string contains() method searches the sequence of characters in this string. It returns true if a sequence of char values are found in this string otherwise returns false.

Syntax

public boolean contains(CharSequence sequence)

The sequence: specifies the sequence of characters to be searched.

#java #java string contains

Java String contains() Example | String contains() Method in Java
2.65 GEEK