public class Main {
public static void main(String[] args) {
Solution solution = new Solution();
solution.textCharacter();
}
}
//==================================
public enum PropertyEnum {
PlumBlossoms,
Orchid,
Bamboo,
Chrysanthemum;
}
//==================================
public class Solution {
public void printCharacter(PropertyEnum s) {
switch (s) {
case PlumBlossoms:
System.out.println(
"PlumBlossoms: A noble man who explores the waves and the snow");
break;
case Orchid:
System.out.println(
"Orchid: A sage of the world, the fragrance of the deep valley");
break;
case Bamboo:
System.out.println("Bamboo: A gentleman of modesty and elegance");
break;
case Chrysanthemum:
System.out.println("Chrysanthemum: A hermit of the world");
break;
}
}
//同一个类下,方法之间调用不用实例化;
public void textCharacter() {
//把枚举值转换成数组
PropertyEnum[] values = PropertyEnum.values();
for(int i=0; i<values.length; i++){
printCharacter(values[i]);
}
}
}