Skip to content

Commit 11d23bf

Browse files
committed
添加设计模式的教程
1 parent 2fe4681 commit 11d23bf

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package cn.byhieg.designpatterntutorial.singleton;
2+
3+
/**
4+
* 该类线程不安全,是延迟加载的懒汉模式
5+
* Created by shiqifeng on 2017/3/14.
6+
* Mail byhieg@gmail.com
7+
*/
8+
public class SimpleSingleton {
9+
10+
private static SimpleSingleton simpleSingleton;
11+
12+
private SimpleSingleton(){
13+
14+
}
15+
16+
public static SimpleSingleton getInstance(){
17+
if (simpleSingleton == null) {
18+
simpleSingleton = new SimpleSingleton();
19+
}
20+
return simpleSingleton;
21+
}
22+
}

0 commit comments

Comments
 (0)