标签:优点 each bsp 单例设计模式 pre list 设计模式 div 系统资源
public class Student { private static Student s = new Student(); private Student() { } public synchronized static Student getStudent() { return s; } }
public class Teacher { private static Teacher t; private Teacher() { } public synchronized static Teacher getTeacher() { if (t == null) { t = new Teacher(); } return t; } }
标签:优点 each bsp 单例设计模式 pre list 设计模式 div 系统资源
原文地址:https://www.cnblogs.com/nangongyibin/p/10183662.html