This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Why is the following generating parse exceptions when parsing using the Currency instances of Number format.
The output of the above is
It looks like parsing of numbers is fine but it is choking when it comes to use the two currency instances namely:
Also is there a way i can find out what is the type of the object being processed inside the for loop? I used "nf.getClass().getName()" in the above example but it always returns the generic type "DecimalFormat". I want to be able to know if it is processing a currency instance or a number instance.
I am not sure but I think new Locale("fr") will not work as this is a language and not a region. There are many regions outside France where French is spoken. Therefore you need a region like new Locale("en","us"));.