Defining and using enumeration class java

1. Define enumeration class


public enum RedActiveStatusEnum {
no_start ( "not started",. 1),
READY ( "preparation", 2),
the PROCESSING ( "in progress",. 3),
END_NO_FINISH ( "Closed receiving unfinished",. 4),
END_YES_FINISH ( " has completed receiving end ",. 5),
END_FORCE (" the forced termination ",. 6);

Private String name;
Private Integer value;
Private RedActiveStatusEnum (name String, Integer value) {
this.name = name;
this.value = value;
}

String getName public () {
return name;
}

public void the setName (String name) {
this.name = name;
}

public Integer the getValue () {
return value;
}

public void setValue(Integer value) {
this.value = value;
}
}


2.使用枚举类
RedActiveStatusEnum.NO_START.getValue()

Guess you like

Origin www.cnblogs.com/guangxiang/p/12529866.html