• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Enum-doubt

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have some collected links for SCJP.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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

http://www.oreilly.com/catalog/javaadn/chapter/index.html

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic