You shouldn’t depend on the int value of an enum , only on its actual value. Enums in Java are a different kind of monster and are not like enums in C, where you depend on their integer code. Regarding the example you provided in the question, Font. PLAIN works because that’s just an integer constant of the Font class.