Java中System.out.println()和System.out.print()有什么区别?
println ()通过写入行分隔符字符串终止当前行。在打印()方法只打印给定的内容。
示例
public class Sample {public static void main(String args[]) {
System.out.println("Hello");
System.out.println("how are you");
System.out.print("Hello");
System.out.print("how are you");
}
}
输出结果
Hellohow are you
Hellohow are you
以上是 Java中System.out.println()和System.out.print()有什么区别? 的全部内容, 来源链接: utcz.com/z/347258.html