问答题 本程序判断一个字符串"Tom"是否在另外一个字符串"I am Tom, I am from China."中出现。 public class exam_38{ public static void main(String[] args){ ______; str1=:I am Tom, I am from China."; str2="Tom"; int i=______; if(______) System.out.println("""+str2+""is in the string:""+str1+"""); else System.out.println("""+str2+""is not in the string:""+str1+"""); } }
【正确答案】String str1, str2 str1. indexOf (str2) i!=-1
【答案解析】