标签:设计模式
package com.eyugame.modle; /** * 饿汉式单例模式 * @author JYC506 * */ public class Single { private static Single single=new Single(); public Single getInstance(){ return single; } } /** * 懒汉式单例模式 * @author JYC506 * */ class Single2{ private static Single2 single2; public Single2 getInstance(){ if(single2==null){ return new Single2(); }else{ return single2; } } }
标签:设计模式
原文地址:http://blog.csdn.net/h348592532/article/details/45251351