这意味着有人可以写:
HelloWorld helloWorld = new HelloWorld();
如果您 可能 不希望他们这样做-您不提供任何实例成员,那么为什么要允许他们创建实例?将代码重写为:
final class HelloWorld { private HelloWorld() { // Prevent instantiation // Optional: throw an exception e.g. AssertionError // if this ever *is* called } public static void main(String[] args) { System.out.println("Hola Mundo!"); }}


