我有一个数组String[] questions={"adorable", "able", "adventurous"};
,我也有一个包含所有形容词的数组 t[]。我想在数组 t[] 中找到可爱、能干和冒险的词。到目前为止,我有这个行代码,但它似乎不起作用。有人可以帮帮我吗?
String u = sn.nextLine();
String[] t = u.split(" ");
for (y = 0; y <= question.length; y++) {
for (int w = 0; w < t.length; w++) {
if (t[w].equals(question[y])) {
System.out.print(t[w] + " ");
break;
}
}
}