This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

enumeration  RSS feed

 
saravanan ragunathan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Coffee.CoffeeSize.BIG; i can get CoffeeSize just using the class name Coffee..i think enum type is implicitly static

 
Campbell Ritchie
Marshal
Posts: 55677
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not at all. You have declared a class with an instance field and you are using that instance field to store data. There is nothing static or unusual about that.

Bad design, maybe, having non-private fields, but not static.
 
Campbell Ritchie
Marshal
Posts: 55677
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The name of the enum is Coffee.CoffeeSize; you are using that class name without having to create an object of Coffee.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!