Java String contains example

String’s contains method checks if sequence of characters can be found in String. It returns true if character sequence is present in String else return false.

Method Signature:

String contains Example:

When you run above program, you will get below output:

Please note that contains method is case sensitive as you can see in above example

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *