Martin Probst's weblog

Why is String.format() static?

January 16, 2008 at 11:01 #

I really wonder why they made java.lang.String.format(String format, Object... args) a static method. Compare:

String message = String.format("Failed to quizzle the fibble: %s", fibble);

with:

String message = "Failed to quizzle the fibble: %s".format(fibble);

The latter isn't only more object-oriented (static methods are in effect global procedures), it's also less typing.


← MacHeist software bundleLeave a replyTomcat startup timeouts in Eclipse→
Leave a reply »