Is there a java convention for packaging enums?

sabrina2020 picture sabrina2020 · Mar 25, 2016 · Viewed 16.3k times · Source

Is there a Java convention for packaging enums? if not is there a best practice? Should I put them all in one package "myapp.enum" or should I put each enum in its related package?

Answer

Mureinik picture Mureinik · Mar 25, 2016

enums in Java should be treated like any other class, and should probably be placed in the package that's most related to them. There's no advantage in having a separate "enums" package.