Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes chapter 3 kb, enums 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 "chapter 3 kb, enums" Watch "chapter 3 kb, enums" New topic

chapter 3 kb, enums

timo corn
Ranch Hand

Joined: Oct 26, 2013
Posts: 68

I am stuck with p. 281 with the following code:

Can you explain the diff. between getValue on line 6 and getValue on line 9? Line 9 includes the instance variable points. Which will be called on line 12 (there is an error, must be getValue)

Raymond Tong
Ranch Hand

Joined: Aug 15, 2010
Posts: 238

where does the method getBidValue defined ?
timo corn
Ranch Hand

Joined: Oct 26, 2013
Posts: 68

I think this is a fault, must be getVAlue instead of getBidValue..
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

Yes, there is an error in the book. Change Suits.NOTRUMP.getBidValue(3) to Suits.NOTRUMP.getValue(3)
Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 125

When you'll give a call:

then the getValue method at line 6 will be called, and
When you'll give a call to getValue on any other enum variables,
then the getValue method at line 9 will be called.

getValue method at line 6 basically overrides the one at line 9 only for enum variable NOTRUMP.

OCPJP 6 - 96%
Currently working on Scala at Knoldus Software
I agree. Here's the link:
subject: chapter 3 kb, enums
It's not a secret anymore!