Skip to content

Commit 7c42197

Browse files
committed
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy