What is the output of the following code?
NumberFormat fmt = new NumberFormat(Locale.US);
System.out.println(fmt.format(123123.99));
g
Class NumberFormat is an abstract class-you can't instantiate it.
Class NumberFormat defines multiple factory methods to create and return an object of the relevant classes that implement NumberFormat, like getInstance()
, getInstance(Locale)
, getNumberInstance()
, and getNumberInstance(Locale)
.