• Post Reply Bookmark Topic Watch Topic
  • New Topic

Elements of enum?  RSS feed

 
Rajeev Srikhar
Ranch Hand
Posts: 75
Chrome Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use enum types any time you need to represent a fixed set of constants as per https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html .
So, when I define like below

As we know constant in java is static final, so the elements SUNDAY, MONDAY ... are public static final?
If so what are the default and final values assigned to those elements?
 
Tim Cooke
Marshal
Posts: 3873
233
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajeev Pedada wrote:If so what are the default and final values assigned to those elements?

The values are themselves.

So the value of Day.MONDAY is Day.MONDAY. There is no other value associated with it.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!