java string contains substring

Substring Contains String

In C/C++, string is an array of characters with a terminating /0. But in Java, the scenario is completely different. In Java, string exists as a class String from java.lang package. To make string manipulation easy, Designers introduced many methods in String class with different functionality. Of them two are…

String contains() Java

Existence of a substring in the main string can be checked with String contains() method.

Output screen on String contains() Java Existence of a small string (substring) can be checked with indexOf() method also. For other String and StringBuffer API methods check String and StringBuffer.