wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Why Enum type are not  extended futher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Why Enum type are not  extended futher" Watch "Why Enum type are not  extended futher" New topic

Why Enum type are not extended futher

kaushik vira
Ranch Hand

Joined: Feb 01, 2007
Posts: 102
By default enum type is consider as final we can`t further extend it. can any one give me good like to refer all the rule of enum.

enum Day{Monday, Sunday}

public class Test extends Day{

public static void main(String[] args){
Day d = null;

After all Day will become a normal class, is there any specification that it`s internally marked as final.

kaushik Vira
SCJP, Preparing SCWCD..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

You could regard an enum as a special kind of class.

You can't extend an enum with another normal class - that would be very strange. What would a class that extends an enum be - some strange kind of enum with extra stuff added?

You also can't extend an enum with another enum. This page from Sun's tutorials explains why:
Note: All enums implicitly extend java.lang.Enum. Since Java does not support multiple inheritance, an enum cannot extend anything else.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Why Enum type are not extended futher
Similar Threads
Java enums, space, and display values
Difference between inner class and inner enum
declaring Enum variable as "final"
Issues With Enum