-2
有了這段代碼,我得到一個錯誤:Package Hangman缺失。所以我不能使用任何Hangman導入。我在哪裏可以找到這個?圖書館netbeans Java
import java.util.Scanner;
import hangman.Hangman; // I have imported it here
public class Hangman {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
Hangman hangman = new Hangman();
System.out.println("************");
System.out.println("* Hangman *");
System.out.println("************");
System.out.println("");
printMenu();
System.out.println("");
while (hangman.gameOn()) {
System.out.println(" Type a command: ");
String command = reader.nextLine();
if (command.equals("quit")) {
break;
}
System.out.println("Thank you for playing!");
}
}
public static void printMenu() {
System.out.println(" * menu *");
System.out.println("quit - quits the game");
System.out.println("status - prints the game status");
System.out.println("a single letter uses the letter as a guess");
System.out.println("an empty line prints this menu");
}
}
你的進口在哪裏?你的項目結構是什麼? – SMA