There is a requirement for public classes - they should be placed in a file with a name that matches the name of the class.
But it is not required to have a class with the same name in a file. Any non-public classes or comments (as in this question) can be n the .java file. The file may be even empty - and, nevertheless, the compiler will process it correctly.
Login in to like
Login in to comment