Welcome to JavaRanch! (Always nice to see more Mac users.
)
As already indicated, each .java file can contain
at most one top-level class that's declared public. (It is not required to contain any.) If a .java file contains a top-level public file, then the name of the file must match that public class name exactly.
But also note that Java is case-sensitive, so "guessgame" (the name of your file) is
not the same as "GuessGame" (the name of the class).
The best approach here is to put each top-level class in its own separate file, named to match the class name. This keeps things nice and neat, so you can easily find a class definition by the name of the file. Although as lei suggested, you
could get around this by removing the "public" modifier from the class declarations.