枚举方法使用

介绍

示例

public class TestEnum {

    public enum Denominator {
        SUM("1"),AVG("$#"),COUNT("$##"),MAX("$MAX"),MIN("$MIN");

        private String typeName;

        Denominator(String typeName) {
            this.typeName = typeName;
        }

        public String getTypeName() {
            return this.typeName;
        }
    }

    
    public static void main(String[] args) {
    	Denominator d = Denominator.AVG;
    	 System.out.print(d.getTypeName());
	}
}

猜你喜欢

转载自my.oschina.net/guoenzhou/blog/1631535