public abstract class Enum<E extends Enum<E>>
implements Comparable<E>, Serializable
class StatusCode extends Enum<StatusCode>
In java every enum is subclass of the class Enum
. I want to inherit Enum
class into my custom class 'StatusCode'. I have tried to do the same, but compiler throws an error. details are as follows
The type StatusCode may not subclass Enum<StatusCode> explicitly
- Bound mismatch: The type StatusCode is not a valid substitute for the bounded parameter <E extends
Enum<E>> of the type Enum<E>
If I cannot extend Enum class explicitly why not? This is not a final class, what is making sure that enum class can't be extended ?