Java String contains() method

tutorial and example
tutorial and example

contains() method returns true only if it contains the given sequence of  characters otherwise it returns false.

syntax:

parameters:

sequence : It is the sequence to be searched.

Returns:

It returns true when specified sequence character is found, Otherwise it returns false

Throws:

NullPointerException :when the sequence of characters is not found.

Example 1:

Output:

Example 2: Case Sensitive

Output:

Example 3: Case Insensitive

Output: