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

Doubt in K&B SCJP 5: topic Chapter 6

 
Oliver Hernandez
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the self test for this chapter, question 8, I don't understand how "C." is a true statement:

C. Both Currency and NumberFormat objects must be constructed using static methods.


What is a Currency object?? The chapter doesn't cover such a class, except for getting a NumberFormat instance via the getCurrencyInstance() factory method. Is this a typo in the statement, that maybe should be reworded to something like "Both number and currency formatter objects must be constructed using static methods in the NumberFormat class"?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Oliver Hernandez:
...What is a Currency object?? The chapter doesn't cover such a class...

If you check the API documentation (which you should bookmark), you will see that the java.util.Currency class does not have any public constructors. Instead, it has static methods, getInstance(Locale locale) and getInstance(String currencyCode), both of which return a reference to an instance of Currency.
 
Oliver Hernandez
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick reply, as I'm studying like mad for the test this coming Thursday!

I did find that java.util.Currency class you mention, but that isn't on any of the SCJP5 objectives. What was even more frustrating in missing that question is that the chapter does not cover java.util.Currency.

I still believe the wording of this question is incorrect, and am hoping to hear from one of the authors here to clear me up.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic