File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
singleton/src/main/java/com/iluwatar Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public static void main(String[] args) {
2424
2525 EnumIvoryTower enumIvoryTower1 = EnumIvoryTower .getInstance ();
2626 EnumIvoryTower enumIvoryTower2 = EnumIvoryTower .getInstance ();
27- System .out .println ("enumIvoryTower1=" + enumIvoryTower1 . getDeclaringClass (). getCanonicalName () + "@" + enumIvoryTower1 . hashCode () );
28- System .out .println ("enumIvoryTower2=" + enumIvoryTower2 . getDeclaringClass (). getCanonicalName () + "@" + enumIvoryTower2 . hashCode () );
27+ System .out .println ("enumIvoryTower1=" + enumIvoryTower1 );
28+ System .out .println ("enumIvoryTower2=" + enumIvoryTower2 );
2929 }
3030}
Original file line number Diff line number Diff line change @@ -11,4 +11,9 @@ public enum EnumIvoryTower {
1111 public static EnumIvoryTower getInstance () {
1212 return INSTANCE ;
1313 }
14+
15+ @ Override
16+ public String toString () {
17+ return getDeclaringClass ().getCanonicalName () + "@" + hashCode ();
18+ }
1419}
You can’t perform that action at this time.
0 commit comments