java设计模式1:单例模式懒汉和饿汉线程安全(synchronized+volatile)
懒汉模式
懒汉模式没啥好讲,直接代码
public class test{
public static void main(String args[]){
Student student1 = Student.getInstance();
Student student2 = Student.getInstance();
System.out.pr...
原创
2019-12-25 10:56:55 ·
1186 阅读 ·
0 评论