参考:https://www.jianshu.com/p/ceb5ec8f1174spa
https://www.jianshu.com/p/fa15f63d399a3d
用一个静态方法来对外提供自身实例的方法,即为咱们所说的静态工厂方法(Static factory method)
code
//私有化构造方法 private Student() {}; private static volatile Student student; //静态工厂方法 public static Student getStudentInstance() { return new Student(); }
如:blog