Solution is to rename the file or the class name to make them same. If a public class name is ABC then the file name of that class must be ABC.java. So always copy the class name and paste it when naming the file, then we will not face this error anymore.
If the above solutions do not work for you. Please comment below giving your code. I'll try to respond.