如果已更换
for (int index = 0; index < wordTable.length; index++) {与
for (int index = 0; index < length; index++) {那很可能不是您真正想要的。
更好的方法是这样的:
public static void inputMethod(int length, char letter, int position) { // check if input is valid if(position < length) for (int index = 0; index < wordTable.length; index++) { if (length == wordTable[index].length() && letter == wordTable[index].charAt(position) ) System.out.println(wordTable[index]);}


