1:用户交互Scanner
2:顺序结构
3:选择结构
4:循环结构
4.1: break
4.2: continue
学习内容:
1:用户交互Scanner
一、Scanner初步
1、 hasNext() | hasNextLine() 输出bool
2、 next() | nextLine() 输出内容
二、Scanner进阶
3、 hasNextInt() | hasNextFloat() | …输出bool
4、 nextInt() | nextFloat() | …输出内容
三、Scanner高阶
5、通过while循环使交互陷入重复阶段
e.g. while(screen.hasNextDouble()){}
四、if | switch | while| do while | for | goto
- if
if(){
}else if(){
}else if(){
}else{
} - switch
switch(grade){
case’A’ :
System.out.println(" great “);
break;
case’B’ :
System.out.println(” great “);
break;
defaule:
System.out.println(” unknown "); - do while 和 while
do{}while(); <<=>>while(){}
dowhile 会至少执行一次。而while先判断有时不会执行 - for(初始化值;条件判断;迭代){}
while(true) <<=>>for( ; ;)
for(x:array){print(x)} #输出数组
}
标签,e.g. label: for(){}跳过。已记忆



