枚举是如何实现的?(枚举的线程安全性及序列化问题)
2021-07-10 03:07
标签:final color object node tor 解决 outside 通过 class 枚举是如何实现的?(枚举的线程安全性及序列化问题) 标签:final color object node tor 解决 outside 通过 class 原文地址:https://www.cnblogs.com/More-World/p/9563394.html
1 public enum t {
2 SPRING,SUMMER,AUTUMN,WINTER;
3 }
1 public final class T extends Enum
2 {
3 private T(String s, int i)
4 {
5 super(s, i);
6 }
7 public static T[] values()
8 {
9 T at[];
10 int i;
11 T at1[];
12 System.arraycopy(at = ENUM$VALUES, 0, at1 = new T[i = at.length], 0, i);
13 return at1;
14 }
15 public static T valueOf(String s)
16 {
17 return (T)Enum.valueOf(demo/T, s);
18 }
19 public static final T SPRING;
20 public static final T SUMMER;
21 public static final T AUTUMN;
22 public static final T WINTER;
23 private static final T ENUM$VALUES[];
24 static
25 {
26 SPRING = new T("SPRING", 0);
27 SUMMER = new T("SUMMER", 1);
28 AUTUMN = new T("AUTUMN", 2);
29 WINTER = new T("WINTER", 3);
30 ENUM$VALUES = (new T[] {
31 SPRING, SUMMER, AUTUMN, WINTER
32 });
33 }
34 }
1 public static final T SPRING;
2 public static final T SUMMER;
3 public static final T AUTUMN;
4 public static final T WINTER;
5 private static final T ENUM$VALUES[];
6 static
7 {
8 SPRING = new T("SPRING", 0);
9 SUMMER = new T("SUMMER", 1);
10 AUTUMN = new T("AUTUMN", 2);
11 WINTER = new T("WINTER", 3);
12 ENUM$VALUES = (new T[] {
13 SPRING, SUMMER, AUTUMN, WINTER
14 });
15 }
1 public enum EasySingleton{
2 INSTANCE;
3 }
1 public static
上一篇:python异常处理
下一篇:排序算法小结