当前位置: 技术问答>java相关
请问print与println的区别是什么?
来源: 互联网 发布时间:2015-06-17
本文导语: 请问print与println的区别是什么? | print打完不换行 println换行打印: print("s"); print("t"); 结果: st println("s"); println("t"); 结果: s t | print public void print(String s) Print a string. If the ...
请问print与println的区别是什么?
|
print打完不换行
println换行打印:
print("s");
print("t");
结果:
st
println("s");
println("t");
结果:
s
t
println换行打印:
print("s");
print("t");
结果:
st
println("s");
println("t");
结果:
s
t
|
print
public void print(String s)
Print a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted 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:
s - The String to be printed
println
public void println(String x)
Print a String and then terminate the line. This method behaves as though it invokes print(String) and then println().
Parameters:
x - The String to be printed.
public void print(String s)
Print a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted 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:
s - The String to be printed
println
public void println(String x)
Print a String and then terminate the line. This method behaves as though it invokes print(String) and then println().
Parameters:
x - The String to be printed.