PrintStream(System.out):
public void println(Object x) {
String s = String.valueOf(x);
synchronized (this) {
print(s);
newLine();
}
}
String:
public static String valueOf(Object obj) {
return (obj == null) ? "null" : obj.toString();
}
Object:
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
看看原码就懂了 |