Is anything like this possible in Java? Can one assign custom numeric values to enum elements in Java?
public enum EXIT_CODE {
A=104, B=203;
}
If you're looking for a way to group constants in a class, you can use a static inner class:
public class OuterClass {
public void exit(boolean isTrue){
if(isTrue){
System.exit(ExitCode.A);
}else{
System.exit(ExitCode.B);
}
}
public static class ExitCode{
public static final int A = 203;
public static final int B = 204;
}
}