键盘输入结合判断语句-if-else进行判断 equals用法:比较两个数是否相等,引用类型数据比较的是他们的内存地址(equals是属于Object类里面的,没有重写过是比较值)
随机数的产生
java8官方文档地址Java Platform SE 8Java Platform SE 8
CTRL + F 弹出搜索框,输入Math找到键盘获取数据的使用文档,根据选择设置。
int random = (int) (Math.random() * 90 + 10);
System.out.println(random);
switch-case分支 循环结构中continue结束当次循环
只能写6种数据类型 byte、short、char、int、枚举类型(JDK5.0)、String类型(JDK7.0),
case后面只能是常量
int a = 1;
switch(a){ //switch(a / 1)
case 0:
System.out.println("输出0");
break; //终止运行
case 1:
System.out.println("输出1");
break;
dafault:
System.out.println("前面不满足输出这个");
}
sout(1);
循环结构
for循环:可以使用break结束当前循环
whlie循环:可以使用break结束当前循环循环
do-whlie循环:至少执行一次;可以使用break跳出循环
嵌套循环:使用循环结构输出九九乘法表
数组
数组声明:静态初始化;动态初始化。
int[] array = new int[]{1,2,3,4};
int[] array2 = new int[5];
String[] array3 = new String[5];
array2[0] = 1; //数组赋值;使用下标找位置
sout(array2.length); //获取数组长度 长度5
动态初始化储存学生数据
二维数组长度的获取和调用
产生随机数,储存到arrays数组,并排序
Arrays工具类:提供操作数组的方法,排序和搜索
void shot(int[] a)