Quote:
Originally Posted by Dr. McKay
Have to instantiate an object in order to format a number?
|
As a side note, you're not instantiating an object as much as asking the provider for the NumberFormat abstract class to do it for you. For that matter, having not looked at the SPI code for NumberFormat, it could easily cache the instances of the various NumberFormats for the default locale, so calling getInstance only gets you a reference to an already allocated object.
Personally, I think that'd be a dumb way to do it, but meh.
Anyway, I mentioned C# because it has
.ToString overloads to do formatting on the various number types. Then again, all number types in C# are structs rather than primitives.
__________________