Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enum doubt

 
Divya Gehlot
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one explain me why my given answer is in correct as I typed same code in eclipse its showing lot of errors so only I am posting it here.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Divya,

your Fabric class doesn't start with a {


The fact, that for example
Color skyColor = BLUE;
does not compile is because the main method belongs to the outer class Fabric and not to the enum class.


Bu.
 
Divya Gehlot
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know what will be the possible the above program.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Divya,

How could option E an answer. Operator + is overloaded only for String objects and wrapper objects but not for enum. How could you get "E" as an answer. I feel the second answer is "F" as ordinal() is a public method available in Enum class and it is inherited by all enums declared.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic