Why is String.format() static?

Jan. 16, 2008, 11:01 a.m.

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.


▸ Add a comment