permaculture playing cards
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enum doubt " Watch "Enum doubt " New topic

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.


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.
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.
I agree. Here's the link:
subject: Enum doubt
It's not a secret anymore!