I looked to the web for inspiration, and couldn't find anything Java specific, so, I have arrived at the following:
class MyClass {
private static enum EXIT {
OK(0), BAD_COMMANDLINE(1), INPUT_ERROR(10);
EXIT (int code) {
this.code = code;
}
private int code;
public int getCode() {
return code;
}
}
OK(0), BAD_COMMANDLINE(1), INPUT_ERROR(10);
EXIT (int code) {
this.code = code;
}
private int code;
public int getCode() {
return code;
}
}
public static void main (String[] args) {
if (args.length() < 1) {
System.exit(EXIT.BAD_COMMANDLINE.getCode());
}
System.exit(EXIT.OK.getCode());
}
}
No comments:
Post a Comment