File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
singleton/src/main/java/com/iluwatar Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ public static void main(String[] args) {
2222 System .out .println ("threadSafeIvoryTower1=" + threadSafeIvoryTower1 );
2323 System .out .println ("threadSafeIvoryTower2=" + threadSafeIvoryTower2 );
2424
25- EnumIvoryTower enumIvoryTower1 = EnumIvoryTower .getInstance () ;
26- EnumIvoryTower enumIvoryTower2 = EnumIvoryTower .getInstance () ;
25+ EnumIvoryTower enumIvoryTower1 = EnumIvoryTower .INSTANCE ;
26+ EnumIvoryTower enumIvoryTower2 = EnumIvoryTower .INSTANCE ;
2727 System .out .println ("enumIvoryTower1=" + enumIvoryTower1 );
2828 System .out .println ("enumIvoryTower2=" + enumIvoryTower2 );
2929 }
Original file line number Diff line number Diff line change 88public enum EnumIvoryTower {
99 INSTANCE ;
1010
11- public static EnumIvoryTower getInstance () {
12- return INSTANCE ;
13- }
14-
1511 @ Override
1612 public String toString () {
1713 return getDeclaringClass ().getCanonicalName () + "@" + hashCode ();
You can’t perform that action at this time.
0 commit comments