Before Refactor
static final int MAN = 1; static final int WOMAN = 2;
After Refactor — Option1
enum Gender{ MAN, WOMAN }
After Refactor — Option2
class Gender{ static final Gender MAN = new Gender(1); static final Gender WOMAN = new Gender(2); private Gender(int value){ } }
Benefits: Type Safe