【发布时间】:2012-04-18 13:13:46
【问题描述】:
我有 3 个带常量的字符串数组。例如:
String[] digit = {"one", "two", "three"};
String[] teen= {"ten", "twenty", "thirty"};
String[] anchors = {"hundred", "thousand", "million"};
我正在考虑将这些分别转移到枚举中,因此我将拥有 3 个枚举类:digit、teen 和 anchors,并实现了 getValue 方法。但我不想将它们放在单独的文件中,因为我只有少量数据和相同类型的数据。将所有这些与访问方法放在同一个有意义的 java 文件中的最佳方法是什么?
【问题讨论】:
标签: java arrays enums constants