public classes are located by searching the directories in your CLASSPATH for class files with a filename starting with your class name. If a source file had more than one public class, which name would javac give the class file?
The answer can be found here. So the compiler will look for a public wet.sprocket.Toad class/interface in the wet/sprocket/Toad.java file. But if the wet/sprocket/Toad.java file could contain another public class/interface, eg Frog, the compiler has no knowledge how to find a source file for Frog (Toad.java?!). This is an "optional restriction on compilation units in file-based implementations." [ July 01, 2004: Message edited by: Irina Goble ]