题目描述:
编写程序,显示Welcome to Java、Welcome to Computer Science、Programming is fun
代码:
public class PrintfMessage{
public static void main(String[] args){
System.out.println("Welcome to Java");
System.out.println("Welcome to Computer Science");
System.out.println("Programming is fun");
}
}
TIPS:
- println输出会换行,而printf不会;
- print中实现换行需要用到转义字符。