输出语句的区别
[1] System.out.println(“”);------先输出后换行
[2] System.out.print(“”);--------先输出不换行。
package com.charwin.www;
public class Output_Different {
public static void main(String[]args){
// 这是输出后换行。
System.out.println("This is a dog!");
System.out.println("This is a cat!");
// 这个只有输出,并不会换行。
System.out.print("This is a dog!");
System.out.print("This is a cat!");
// 如果只有 System.out.println(""); ----- 起到换行作用。
System.out.print("This is a dog!");
System.out.println("");
System.out.print("This is a cat!");
}
}