📜  如何在字符串中使用 if 语句 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:38.977000             🧑  作者: Mango

代码示例2
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"));