O'Reilly logo
  • Oleksandr Ivanov thinks this is interesting:

The name of the file must match the name of the class.


Cover of OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808


small remark: "must match the name of the PUBLIC class".
if you have file with name Foo.java it is possible to compile it with content inside:
class Bar {} but NOT public class Bar{}