When using the getInstance() method of the abstract java.text.NumberFormat class, what is the actual

Posted by iamchuckb on Stack Overflow See other posts from Stack Overflow or by iamchuckb
Published on 2010-05-17T16:02:03Z Indexed on 2010/05/17 16:10 UTC
Read the original article Hit count: 290

Filed under:
|
|
|

This question expands upon the one at abstract-class-numberformat-very-confused-about-getinstance. I feel that this question is different enough to merit being asked on its own.

In the answers to that question, it was stated that a code statement such as

NumberFormat en = NumberFormat.getInstance(Locale.US);

returns an object that is a subclass of the java.text.NumberFormat class. It makes sense to me why the return type can't be just an instance of NumberFormat since that is an abstract class. Rather, it was stated that the returned object is at least an instance of NumberFormat, but actually something else.

My question is this: what specifically is the class of the object that is returned? In the Sun documentation the only subclasses I see are ChoicesFormat and DecimalFormat. Is there some sort of behind the scenes compiler voodoo going on here?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about java

Related posts about numberformat