The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enum-doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enum-doubt" Watch "Enum-doubt" New topic


joshua antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 117
I have some doubt on enum.
Are the points below correct?

1.. Enum cannot extend a class but can implement an interface.

2.. we cannot extend or implement enum

3.. Enum are implicitly final(i doubt but i read somewhere)

Any link regarding enum will be helpful
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Have some collected links for SCJP.
Anupama Ponnapalli
Ranch Hand

Joined: Jun 12, 2006
Posts: 66

Here's a link to a tutorial on enums in pdf format:

In short:

1. Enum cannot extend a class but can implement an interface. true

2. we cannot extend or implement enum. true. Because enums are basically classes and when the byte code is generated, they are final. They are not interfaces, so they cannot be implemented.

3. Enums are implicitly final. true.

An interesting note on side: enums declared within class (enums that are not top level classes) are static by default whether use the keyword or not. But enums that are top level classes in their own files are not static, in fact, if you use the static keyword, a compile time error is raised.
I agree. Here's the link:
subject: Enum-doubt
It's not a secret anymore!