what should I do about it? the tutorial I'm using does not say to save three different files, so I think this was supposed to work.
and I have no idea of how to solve this.
Rubens Martins wrote:As I said before, I am not supposed to save three different files.
One of the rules of Java is that if you make a top-level class public, it has to be saved in a file with the same name as the class (and the .java extension). You have two public classes: SimpleDotCom and GameHelper. These need to be in two separate files named SimpleDotCom.java and GameHelper.java.
You can also make the classes not public, as Hunter suggests.
Rubens Martins wrote:
That error is unrelated to the classes being public or not. Math.random() is a method so you need to add parentheses.
Hunter McMillen wrote:Your import statements need to be the first line in the saved file. So instead of having the import in the middle, move it to the top.
It doesn't need to be the first line, but the only things that are allowed to be placed before import statements are the (optional) package declaration, comments and whitespace. Classes definitely do not fall into that group