А еще подскажите плз
Чем объясняется, то что в одном файле нельзя создавать два класса с модификатором public.
Просто второй class по умолчанию - дает создавать.
Я в курсе что каждый класс надо создавать отдельным файлом.
Однако, в учебных целях, интересно узнать с чем связано ограничение ?
According to the Java Language Specification, Third Edition:
This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file
Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
Emphasis is mine.
It seems like basically they wanted to translate the OS's directory separator into dots for namespaces, and vice versa.
So yes, it was a design consideration of some sort