0
do {
System.out.println("Word: " + secretWord.getWordMask());
//System.out.print("Guesses: " + guesses);
System.out.print("Enter your guess: ");
Scanner keyboard = new Scanner(System.in);
String guess = keyboard.next();
WordHider revealChar = new WordHider();
revealChar.revealLetter(guess);
System.out.println(revealChar.getWordMask());
secretWord.revealLetter(guess);
} while();
我的代碼現在不斷地詢問用戶一封信,然後如果它的字的一部分顯示它。我有一個不同類的另一種方法是檢查是否隱藏的文字被發現或不檢查字符是否等於一個字
public boolean isHiddenWordFound() {
for (int i = 0; i < wordMask.length(); i++) {
if(wordMask.charAt(i) == HIDE_CHAR.charAt(0)) {
return false;
,我需要弄清楚如何使該while
部分檢查。但我簡直不知所措,有什麼想法?