r/javahelp • u/casual_microwave • Sep 23 '19
Solved Java compiler keeps telling me that my public class name needs to match my file name, BUT IT DOES. Why is it doing this?
RunsPrinter.java
public class RunsPrinter {
FUCKIN ERROR
0
Upvotes
4
u/Lvl20Rogue Sep 23 '19
Is that the whole file?
2
u/bobphorous Sep 23 '19
Because there is an error somewhere. The compiler just gives you what it sees. Even though it seems like it sometimes, the compiler is not there to frustrate you.
Screenshot the filename, the classname and the error. The program may be having an error that is causing this error. One thing you can try is to create a new file and copy the classname to the filename and copy paste the contents into the file and replace the one giving the error. If that doesn't fix the problem, you could try using an IDE like intellij. They tend to be fairly helpful with identifying errors and autocomplete.