I can create an empty Java enum type, but when i want to add some methods : i get a “syntax error” (into Eclipse).
I found no official documentation about this, so my question is : is it just impossible (so where is it clearly mentioned?) or is it just the compiler which is wrong ?
I can create an empty Java enum type, but when i want to add
Share
Yes it’s possible. You just need to add a
;to terminate the (empty) list of enum constants:JLS Syntax Definition for
enums(Note that without any instances, you’ll only be able to call the
staticmethods of the Enum.)Related: