We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9291065 commit e3598d6Copy full SHA for e3598d6
1 file changed
SingletonPattern/Java/SynchronizedSingleton.java
@@ -0,0 +1,17 @@
1
+public class SynchronizedSingleton
2
+{
3
+ private static SynchronizedSingleton instance = null;
4
+
5
+ private SynchronizedSingleton()
6
+ {
7
+ }
8
9
+ synchronized static public SynchronizedSingleton getInstance()
10
11
+ if (instance == null)
12
13
+ instance = new SynchronizedSingleton();
14
15
+ return instance;
16
17
+}
0 commit comments