About Question enthuware.ocpjp.v8.2.1907 :
Posted: Tue Jun 14, 2016 11:49 am
I find it a bit curious w.r.t.
that the execution works, but the Java Platform Standard Ed. 8 (JDK SE8) Documentation states that for a PrintWriter, the printf(String format, Objects ... arg) and the printf(Locale l, String format, Objects ... arg) both state that it will throw a NullPointerException if the format string is null.
Is it the case that with only 1 string passed in, the JVM considers the string already formatted?
Code: Select all
public void outputText(PrintWriter pw, String text) {
pw.printf(text).print("success");
}
Is it the case that with only 1 string passed in, the JVM considers the string already formatted?