Make String.format(“%s”, arg) display null-valued arguments differently from “null”
问题 Consider the custom toString() implementation of a bean: @Override public String toString() { String.format("this is %s", this.someField); } This yields this is null if someField is null. Is there a way to override the default null string representation of null-valued arguments to another text, i.e., ? without calling explicitly replaceAll(...) in the toString method? Note : The bean inherits from a superclass that could implement Formattable (http://docs.oracle.com/javase/7/docs/api/java