In a java code if I put the non-public class before public class this error pops up.
ref1
But, if I put it after the public class, it does not.
Here I put the class after the public class and it does not show any error.
ref2
This seems to be the case with my compiler alone because I saw creators on YT doing the same thing and it works for them.
Though I know it’s not a major issue and I can just create the class below the public class, I would still like to know why it happens. Does it have something to do with my PC or is there some setting I need to toggle?
Thanks!
DARKBLADE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1