forked from damaohongtu/JavaInterview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSingleton2.java
More file actions
19 lines (18 loc) · 452 Bytes
/
Singleton2.java
File metadata and controls
19 lines (18 loc) · 452 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package JavaBasic;
/**
* @Author MaoTian
* @Classname Singleton2
* @Description 静态内部类
* @Date 上午11:05 2019/8/11
* @Version 1.0
* @Created by mao<tianmao818@qq.com>
*/
public class Singleton2 {
private static final class SingleHandler{
private static final Singleton2 INSTANCE=new Singleton2();
}
private Singleton2(){}
public static Singleton2 getInstance(){
return SingleHandler.INSTANCE;
}
}