> If and only if packages are stored in a file system (§7.2), the host system may choose to enforce the restriction that it is a compile-time error if a class or interface is not found in a file under a name composed of the class or interface name plus an extension (such as .java or .jav) if either of the following is true:
> * The class or interface is referred to by code in other ordinary compilation units of the package in which the class or interface is declared.
> * The class or interface is declared public (and therefore is potentially accessible from code in other packages).
and javac does indeed enforce this restriction, at least for public classes. It's an error to declare a public class called Foo in a file that's called anything except Foo.java.