Skip to content

Commit 0509e48

Browse files
committed
Update IvoryTower.java
1 parent d4ee7a7 commit 0509e48

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

singleton/src/main/java/com/iluwatar/IvoryTower.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
*/
88
public class IvoryTower {
99

10-
private static IvoryTower instance = new IvoryTower();
10+
private static IvoryTower instance;
1111

12-
private IvoryTower() {
13-
}
12+
private IvoryTower() {}
1413

1514
public static IvoryTower getInstance() {
15+
if(instance == null){
16+
instance = IvoryTower();
17+
}
1618
return instance;
1719
}
1820
}

0 commit comments

Comments
 (0)