posted 23 years ago
The requirement for a source file to have the same name as the public class contained within it is a trick used to greatly speed up compilation in Sun's "javac" compiler, and others which work the same way. Not all compilers work the same way; IBM Visual Age and Asymetrix Supercede, for example use a repository approach where all source code is stored in a database.
Sun's file naming convention really helps when you have a lot of source files to compile, as it allows the compiler to know which source files to check to see if they have changed. In many ways this removes the need for a tool like "make", and means that the compiler doesn't have to compile everything, every time.