------------恢复内容开始------------
println 与 print区别:
1、print输出之后不换行,如下:
public class Newstart {
public static void main(String[] args) {
int x = 1;
while(x<3) {
System.out.print("Doo");
System.out.print("Bee");
x++;
}
if(x==3) {
System.out.print("Do");
}
}
}
输出:DooBeeDooBeeDo
2、println输出之后要换行,如下:
public class Newstart {
public static void main(String[] args) {
int x = 1;
while(x<3) {
System.out.println("Doo");
System.out.println("Bee");
x++;
}
if(x==3) {
System.out.println("Do");
}
}
}
输出:
Doo
Bee
Doo
Bee
Do
------------恢复内容结束------------
原文地址:https://www.cnblogs.com/ouyangbo12/p/12111262.html