work122.java
package test07;
public class work122
{
enum Constants7
{
A("成员A"),
B("成员B"),
C("成员C"),
D(4);
private String note;
private int i = 4;
private Constants7()
{
}
private Constants7(String note)
{
this.note = note;
}
private Constants7(int i)
{
this.i = this.i + i;
}
public String getNote()
{
return this.note;
}
public int getI()
{
return this.i;
}
}
public static void main(String[] args)
{
for (int i = 0; i < Constants7.values().length; i++)
{
System.out.println(Constants7.values()[i] + "调用getNote方法:" + Constants7.values()[i].getNote());
}
System.out.println(Constants7.valueOf("D") + "调用getI方法:" + Constants7.valueOf("D").getI());
}
}