Inner classes can’t have static methods, so you can’t have main there. However, static nested classes can indeed have main . Also, as aix’s answer says, you can also have multiple package-private top-level classes in the same source file.
Inner classes can’t have static methods, so you can’t have main there. However, static nested classes can indeed have main . Also, as aix’s answer says, you can also have multiple package-private top-level classes in the same source file.