Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7c42197

Browse files
add EnumSingleton
1 parent 1b835f3 commit 7c42197

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.java.design.singleton;
2+
3+
/**
4+
* 枚举实现单例 最佳
5+
* 避免反射攻击、避免序列化问题
6+
*
7+
* @author Administrator
8+
*
9+
*/
10+
public class EnumSingleton {
11+
12+
INSTANCE;
13+
14+
public EnumSingleton getInstance() {
15+
return INSTANCE;
16+
}
17+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /