Java新手,请放轻松!
创建一个简单的教育应用程序来检查论文句子中的人称代词。我几乎让它工作了,我的问题是该方法打印了 12 次(而不是检查 12 个代词并打印一行)。
public static void pronoun (String thesis){
String [] personalPronouns = {"I","me","you","we","us","our","he","him","she","her","they","them"};
for (int i = 0; i < 12; i++){
if (thesis.contains(personalPronouns[i])){
System.out.println("Oops! Looks like your thesis contains personal pronouns. Remember, avoid using I, you, me, we, us, our, etc. in persuasive essays.");
} else {
System.out.println("Looks good. Now it's time to start writing! Your essay outline is saved to a txt file called EssayTutorOutline.");
}
}
}
如果我输入“我有论文”。它返回这个:
看起来不错...
看起来不错...
看起来不错...
看起来不错...
看起来不错...
看起来不错...
哎呀!...
看起来不错...
看起来不错...
看起来不错...
看起来不错...
看起来不错...
我相信这对你们大多数人来说是显而易见的。整晚都在谷歌上搜索答案。任何帮助表示赞赏。