- //新曙光培训@西安
- //www.xinshuguang.org
- enum xsgInput{
- NICKEL,DIME(10),DOLLAR;
- int JiFenQian;
- xsgInput(int JiFenQian){this.JiFenQian=JiFenQian;}
- xsgInput(){}
- }
- public class xsgOutPutEnum{
- public static void main(String[] args){
- //xsgInput values=xsgInput.DIME(10);
- xsgInput values=xsgInput.DIME;
- System.out.println(values);
- System.out.println(xsgInput.DIME.JiFenQian);
- System.out.println(xsgInput.NICKEL);
- System.out.println(xsgInput.NICKEL.JiFenQian);
- }
- }
不能像第14行那样写成DIME(10),虽然它带有参数10