public enum enumUpdateAction {
NEW(0), CHANGE(1), DELETE(2), DELETE_THRU(3), DELETE_FROM(4);
public int codigo;
enumUpdateAction(int codigo) {
this.codigo = codigo;
}
public int getCodigo() {
return this.codigo;
}
}
...
switch (Eventos.get(0).getUpdateaction()) {
case enumUpdateAction.NEW.getCodigo():
ArrayEventos.add(InserirOrdenado(ArrayEventos, Ordem), Ordem);
break;
}
After creating the enum, I'm trying to use this value inside a switch (in this case, NEW corresponds to 0 and therefore I'm trying to use 0 inside the case), but I get the error "constant expression required". Can anyone tell me why this happens?