I have a java file TestThis.java like following:
class A { public void foo() { System.out.println("Executing foo"); } }
class B { public void bar() { System.out.println("Executing bar"); } }
The above code file is compiling fine without any warnings/errors. My question is that is there any way I could access any of class A or B without a top level class from any other external class?
If no then why do Java even permits compiling of such files without a top-level class?