File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B Chapter 3 Question 7 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 "K&B Chapter 3 Question 7" Watch "K&B Chapter 3 Question 7" New topic
Author

K&B Chapter 3 Question 7

Aj Jaro
Greenhorn

Joined: Oct 24, 2010
Posts: 9
How can you have access to the private member of the Suits enum on line 13?


Thank you in advance for helping clear this up.

OCPJP 6
Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

Aj Jaro wrote:How can you have access to the private member of the Suits enum on line 13?


Thank you in advance for helping clear this up.


Yes because it is an inner enum.
This, OTOH

would produce a compiler error.


OCPJP 6.0
Aj Jaro
Greenhorn

Joined: Oct 24, 2010
Posts: 9
Ah, perfect. That was something I should have known. Thank you.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Just a small correction... not related to the question...

does this statement print anything meaningful ?





shouldn't it be like ->


Time is what we want the most, but what we use the worst. -- William Penn
Aj Jaro
Greenhorn

Joined: Oct 24, 2010
Posts: 9
You are right, that it doesn't print anything meaningful, but that was part of the difficulty with choosing the proper answers as well. The available answers were as follows:

Which are true? (Choose all that apply)
A. The output could contain 30
B. The output could contain @bf73fa
C. The output could contain DIAMONDS
D. Compilation fails due to an error on line 6
E. Compilation fails due to an error on line 7
F. Compilation fails due to an error on line 8
and so on

The correct answers were A and B because of how some of the output was unpredictable like you mentioned. You are also correct in stating that using Arrays.asList() will print valuable output as opposed to Suits.values()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: K&B Chapter 3 Question 7