Check out example codes for "contains example in java". It will help you in understanding the concepts better.

Code Example 1

String s1 = "My name is GFG"; 
  
// prints true 
System.out.println(s1.contains("GFG")); 
  
// prints false 
System.out.println(s1.contains("geeks"));

Learn ReactJs, React Native from akashmittal.com