首页>代码>java设计模式代码实例>/设计模式实验/设计模式实验/src/设计模式实验/单例模式/Danlimoshi.java
package 设计模式实验.单例模式;

public class Danlimoshi {
	private static Danlimoshi i = null;
	private Danlimoshi () {}
	
	public static  Danlimoshi getShili() {
		int j = 1;
		if(i==null) {
			System.out.println("第1次实例化...");
			System.out.println("这个类只能有一个实例化...");
			i = new Danlimoshi();
		}
		else {
			
			j = j + 1;
			System.out.println("第" + j + "次实例化...");
			System.out.println("此次实例化将默认采用第一个实例化...");
		}
		return i;
	}
	

}
最近下载更多
等风来2020  LV3 2023年12月10日
壹级天灾  LV14 2023年9月4日
cuiyuu  LV1 2023年2月15日
为了水掉6位用户名  LV4 2022年3月4日
hyuga0410  LV2 2021年12月2日
harrison123  LV2 2021年6月20日
lhxsyd  LV7 2021年3月18日
woyoung  LV1 2021年2月7日
唐僧洗头爱飘柔  LV22 2020年8月20日
487948123  LV8 2020年8月8日
最近浏览更多
等风来2020  LV3 2023年12月10日
2036495585  LV9 2023年9月26日
壹级天灾  LV14 2023年9月4日
fuyouou  LV5 2023年7月7日
微信网友_6411724627349504  LV3 2023年4月3日
cuiyuu  LV1 2023年2月15日
yyds123456  LV2 2022年12月4日
crosa_Don  LV18 2022年7月19日
qijiqiji  LV1 2022年6月11日
陈小灏  LV14 2022年5月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友