This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enum doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enum doubt " Watch "Enum doubt " New topic
Author

Enum doubt

Divya Gehlot
Ranch Hand

Joined: Sep 10, 2006
Posts: 243
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.


SCJP1.5(81%), SCDJWS(94%), next mission SCEA (but need to wait or that)
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
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.


all events occur in real time
Divya Gehlot
Ranch Hand

Joined: Sep 10, 2006
Posts: 243
I want to know what will be the possible the above program.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Enum doubt