Why would you ever want a Java file with no public classes declared in it?

Viewed 5605

There is a statement in the book I'm reading for the SCJP qualification, it says :

Files with no public classes have no naming restrictions

That has made me ask, why would you ever want to do this?

If there are no public classes, then how could other classes ever import and use the file? The only purpose I can see is if the file runs standalone in itself, which could also be odd, such as have an entire application in one file

5 Answers
Related