1.从键盘接收String
System.out.println("test next");
String s = sc.next();//键盘录入任意符号(字母、数字、各种符号都可以),回车结束录入(前提是回车前读取到了有效字符)
System.out.println(s);
System.out.println("test nextInt");
int s1 = sc.nextInt();//键盘录入一个整数(只要整数,否则报异常,会自动去除空格)
System.out.println(s1);
System.out.println("test nextLine");
String s2 = sc.nextLine();//键盘录入一行,回车结束(录入什么输出什么)
System.out.println(s2);
2.三目运算符
简易代码
结果演示
3.自增运算
4.流程控制
九九乘法表