I just found out that Java allows enums to implement an interface. What would be a good use case for that?
Advertisement
Answer
Enums don’t just have to represent passive sets (e.g. colours). They can represent more complex objects with functionality, and so you’re then likely to want to add further functionality to these – e.g. you may have interfaces such as Printable
, Reportable
etc. and components that support these.