I have two classes in a single java file, no internal class or any parent or child class, just two classes in a single file. I know two classes cannot be public in a single java file, they need to be declared in seperate java files. As far as I know is that if we don't specify any access specifier before the class name, the default specifier is given which is public. So if I remove the 'public' keyword from the second class which is not the main class, why does the error of not putting the class in a seperate file go away?
class A{
    
     int a,b;
     static void doSomething(int a, int b){
        int c;
        c=a+b;
    }
}
public class generateSumEg{
    public static void main(String ags[]){
        
        //call function
    }
