12+3是int。只不过print方法用String.valueOf把int转成了string 看API: print public void print(int i) Prints an integer. The string produced by String.valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method. Parameters: i - The int to be printed See Also: Integer.toString(int)
public void print(int i)
打印整数。按照平台的默认字节编码将 String.valueOf(int) 生成的字符串转换为字节,并完全以 write(int) 方法的方式写入这些字节。
调用Integer类中的toString()方法转换成String字符串
看API:
print public void print(int i) Prints an integer. The string produced by String.valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method. Parameters:
i - The int to be printed
See Also:
Integer.toString(int)