File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B Chapter 3 Question 7

 
Aj Jaro
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Achilleas Achix
Ranch Hand
Posts: 123
BSD Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Aj Jaro
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, perfect. That was something I should have known. Thank you.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a small correction... not related to the question...

does this statement print anything meaningful ?





shouldn't it be like ->

 
Aj Jaro
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic