此代码段:
public class NumberFormatException extends IllegalArgumentException {
public NumberFormatException (String test) {
super (test);
}
static NumberFormatException forInputString(String test) {
return new NumberFormatException("Caused By: \"" + test + "\"");
}
}
抛出NullPointerException:
java.lang.NullPointerException
at java.lang.NumberFormatException.forInputString(NumberFormatException.java)
我无法确定'test'的哪个值可能是NullPointerException的根本原因,因为在串联中,如果String的值为null,则在屏幕上打印null。