Feb 16 2008

Is Java re-inventing the WHEEL?

Posted in Java on Saturday, February 16, 2008 at 7:21

I was browsing the internet for some information and I stumbled upon this beautiful quote @ http://horstmann.com/

1980: C

printf("%10.2f", x);

1988: C++

cout << setw(10) << setprecision(2) << showpoint << x;

1996: Java

java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++)
	System.out.print(’ ‘);
System.out.print(s);

2004: Java

System.out.printf("%10.2f", x);

Now, what does that mean? Isn’t it look like re-inventing the printf?

Trackback URI | Comments RSS

Leave a Reply