+ 1
How do I launch this java numbers guessing game?
I'm working on a numbers guessing game out of the head first java book and I cant get it to work. I've got 3 public classes: GameLauncher, Player and GuessGame. Only the GameLauncher class has main method in it. Are these all suppose to be in one file or should they be one inside the other or what? I know the public class usually has to be the file name as well so I assume they're supposed to be in separate files. But anytime I put them in separate files cmd says that I dont have a main method in GuessGame(which is the main syntax of the game). Not sure what to do. Surely the Head First Java book isnt wrong but you never know lol. Any help is appreciated. Thanks!
3 Respostas
+ 3
you put all of your files in the same directory and run the program that has the main method in it. im not sure how it works on sololearn
+ 3
Thank you very much Jenny, I will try that!
0
I had the same issue.
Place all 3 classes to the same file and, as there can be only one public class, keep only GameLauncher public(public class GameLauncher).
then in terminal type in
java [file name].java