Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract Method in enum

 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When we declare some abstract method in a class, we need to make the class abstract. but when we declare an abstract method in an enum we need not do it.



Why is it so?

Sandy
 
Joseph Clark
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the Enum type is implicitly abstract, like a Java interface.

The signature is:

public abstract class Enum<E extends Enum<E>> extends Object implements Comparable<E>, Serializable
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic