File tree 2 files changed +7
-2
lines changed
singleton/src/main/java/com/iluwatar
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) {
24
24
25
25
EnumIvoryTower enumIvoryTower1 = EnumIvoryTower .getInstance ();
26
26
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 );
29
29
}
30
30
}
Original file line number Diff line number Diff line change @@ -11,4 +11,9 @@ public enum EnumIvoryTower {
11
11
public static EnumIvoryTower getInstance () {
12
12
return INSTANCE ;
13
13
}
14
+
15
+ @ Override
16
+ public String toString () {
17
+ return getDeclaringClass ().getCanonicalName () + "@" + hashCode ();
18
+ }
14
19
}
You can’t perform that action at this time.
0 commit comments