Usually we manage constants in interfaces. e.g.:
public interface CommonConstant {
int A_TYPE1=0;
int A_TYPE2=1;
}
But I'm thinking that if the constant belongs to a class, we may just put it into that class? e.g.:
public class A {
public enum Type {
TYPE_ONE(0),
TYPE_TWO(1);
public final int val;
Type(int val) {
this.val = val;
}
}
private int type;
...
}
So which way should be better?