i following book head first java. i've typed in code guess number program. i've had great succession far code in book. when run code following errors:
javac gamelauncher.java:1:error class guessgame public, should declared in file named guessgame.java the file saved 1 main inside gamelauncher.java.
this repeats public class called player. have looked around on net , saw people saying have save class file has main inside. have done. works fine when remove 'public' shouldn't case. have saved files under player.java , guessgame.java still errors.
very new , haven't run trouble until now. know it's going simple.
java source files may contain 0 or 1 public classes, if have more 1 in single .java file, error.
basically, should have 1 top-level class in every java source file.
Comments
Post a Comment