kundor
0
Q:

how to use the if sentence in the string

String str = "Game of Thrones";  

//This will print "true" because "Game" is present in the given String
System.out.println(str.contains("Game"));

/* This will print "false" because "aGme" is not present, the characters
 * must be present in the same sequence as specified in the contains method
 */
System.out.println(str.contains("aGme"));
0
public boolean contains(CharSequence str)
0

New to Communities?

Join the community