Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Override constructor in a enum

 
Elier Rguez
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am curious about if there is any way to implement a new constructor for a particular item in a enum. Like it's possible to override a method.


Thanks in advance.

 
Jack McLaren
Greenhorn
Posts: 13
Mac Mac OS X Mac PPC
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elier Rguez wrote:Hello,
I am curious about if there is any way to implement a new constructor for a particular item in a enum. Like it's possible to override a method.


Thanks in advance.



Do you know that constructors can be overloaded but not overridden ?
 
Ben Pheonix
Ranch Hand
Posts: 46
1
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Good answer. No there is no way you can provide a separate constructor for an enum element. Additionally constructors are overloaded
not overriden.

HTH,
Ben
 
Elier Rguez
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic