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"?
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.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: May 20, 2004
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.