mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-12 04:13:54 +00:00
enum approach of singleton
This commit is contained in:
1 parent
13e6c74d97
commit
13abf49024
2 files changed
+18
No files matched your search
@@ -22,5 +22,9 @@ public class App {
|
||||
System.out.println("threadSafeIvoryTower1=" + threadSafeIvoryTower1);
|
||||
System.out.println("threadSafeIvoryTower2=" + threadSafeIvoryTower2);
|
||||
|
||||
EnumIvoryTower enumIvoryTower1 = EnumIvoryTower.getInstance();
|
||||
EnumIvoryTower enumIvoryTower2 = EnumIvoryTower.getInstance();
|
||||
System.out.println("enumIvoryTower1=" + enumIvoryTower1.getDeclaringClass().getCanonicalName() + "@" + enumIvoryTower1.hashCode());
|
||||
System.out.println("enumIvoryTower2=" + enumIvoryTower2.getDeclaringClass().getCanonicalName() + "@" + enumIvoryTower2.hashCode());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user