public static String[] wordArray(int wordAmount){
String[] words = new String[wordAmount];
Scanner input = new Scanner(System.in);
for(int i = 0; i < wordAmount; i++){
System.out.print("Enter a word: ");
words[i] = input.nextLine();
for(int j = 0; j < wordAmount; i++){
if(words[i].contains(words[j]) & (i != j)){ ///////////////////
System.out.print("The word you entered has already been entered, enter a new word: ");
words[i] = input.nextLine();
}
}
while(words[i].length() > 10 | words[i].length() <= 1 | words[i].contains(" ")){
System.out.print("The word you entered has been rejected, enter a new word: ");
words[i] = input.nextLine();
}
}
return words;
}
코드 뒤에있는 모든 슬래시가있는 코드 줄이 작동하지 않습니다 (문제가있는 줄을 나타 내기 위해 슬래시를 넣으십시오). 나는 여러 번 코드를 재배치했으며 지금까지는 아무 것도 작동하지 않았다. 누구나 왜 작동하지 않는지 알면이 문제에 대한 해결책을 매우 높이 평가할 것입니다.문 조건이 작동하지 않는 경우
오류 메시지 : 스레드에서 예외 "주"java.lang.NullPointerException이
안녕 데빈, 나는 또한 당신을 도울 수있는 더 많은 사람을 얻기 위해 작업하고 언어 태그를 제안한다. – micstr
@aidan 링크는 C++ –