aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Qn on enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Qn on enums" Watch "Qn on enums" New topic
Author

Qn on enums

cs singh
Ranch Hand

Joined: Dec 28, 2005
Posts: 36
Hi all..
do let mw know the ans of following :




thanks,
chani.
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
Hey Chani,

I recognize that question

Anyway, the best way to learn this stuff is to try it out, and then to explain what parts you understand, and what parts are confusing. So, I'll ask the question back to you: What part of this code makes sense to you, and what part are you confused by? For the part that you're confused by, what's your best guess as to what's going on?

Bert


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
cs singh
Ranch Hand

Joined: Dec 28, 2005
Posts: 36
Thanks Bert for the reply!!

In the following code:
when ///line 2 is executing, the control will go to ICELANDIC ( in enum Horse) but i am not getting choosing which option will lead to the result.



Wont this part //* *// will be executed??

Thanks again,
Chani.
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
Hey Chani,

Can you determine what the weight of the PONY and HORSE enum "instances" are? If so, how did they get those weights? Now the question is, what enum mechanism allows the ICELANDIC "instance" to have a weight that's != 1300?

hth,

Bert
cs singh
Ranch Hand

Joined: Dec 28, 2005
Posts: 36
Thanks Bert !!
That helped .. i got the answer, only if u insert option D, it will set the weight of ICELANDIC to 800, thats because, only by that way Method getweight() will be called.
I hope i'm not in wrong direction,
Chani.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Bert]: I recognize that question

Strangely, though I'd never seen it before, I recognized it too.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Qn on enums