public class Main { public static void main (String[] args) { System.out.println("Practice makes perfect!"); } }
输出语句的使用
public class Main { public static void main(String[] args) { System.out.println("v v\n v v \n v "); } }
转义字符的使用'\n'
public class Main { public static void main(String[] args) { System.out.println("The size of short is 2 bytes.\nThe size of int is 4 bytes.\nThe size of long is 8 bytes.\nThe size of long long is 8 bytes."); } }
short-2字节
int-4字节
long-8字节
long long-8字节
public class Main { public static void main(String[] args) { System.out.println("printf(\"Hello, world!\\n\");"); } }
转义语句的使用,用 \ 对 \ 和 " 进行转义