Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enum

 
Venkat Sidh
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the below enum code,



what is the code to print string value Extra Large and invoke age().
 
Matt Russell
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code will not compile. You need to add, at a minimum, a constructor that accepts a String argument.
 
Venkat Sidh
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the full piece of code,

 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far?
 
Aniket Patil
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use size.description and size.age()
 
Venkat Sidh
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry,

I haven't tried that far but in middle I saw few questions online about Enum's, I gave a try and stuck on this particular question.

First of all I shouldn't have tried mock-up questions until I finish studying.

Thanks all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic