流程控制
Flow流程,Java中有三种流程。
一:选择结构
1:if语句
int x = 10;
if (x > 0) {
System.out.println("x是正数");
} else if (x < 0) {
System.out.println("x是负数");
} else {
System.out.println("x是零");
}
2:switch语句
二:循环结构
1:while 循环
2:do-while 循环
3:for 循环
4:增强型 for 循环
最后更新于