java if string contains values code example
Example 1: contains example in java
String s1 = "My name is GFG";
// prints true
System.out.println(s1.contains("GFG"));
// prints false
System.out.println(s1.contains("geeks"));
Example 2: java if string contains character
if (string.contains(character)