Support printing of null references

This commit is contained in:
Eric Scharff 2007-09-27 15:05:55 -06:00
parent 9621679d2a
commit 101b0c3b0e
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ public class PrintStream extends OutputStream {
} }
public void print(Object o) { public void print(Object o) {
print(o.toString()); print(String.valueOf(o));
} }
public void print(char c) { public void print(char c) {

View File

@ -379,7 +379,7 @@ public final class String implements Comparable<String> {
public native String intern(); public native String intern();
public static String valueOf(Object s) { public static String valueOf(Object s) {
return s.toString(); return s == null ? "null" : s.toString();
} }
public static String valueOf(boolean v) { public static String valueOf(boolean v) {