1。 if(条件表达式){
//如果条件表达式的结果为真,则可以运行到该程序段内//否则会跳过该程序段
/if-else结构构成了全集
if(条件){
//代码1:条件为true的情况下会运行Jelse(
//代码2:条件为false的情况下会运行
2。 //多重if
if(条件1){
//代码1:条件1为true时运行
}else if(条件2){//代码2:条件1为false且条件2为true时运行Jelse if(条件3){//代码3:条件1、2都为false且条件3为true时运行Jelsef
//代码4:条件1、2、3都为false时运行
3. 嵌套if:
if(条件1){//代码1: 条件1为true
if(条件2){
//代码2:条件1、2都为true
//代码3:条件1为true
Jelse(
//代码4:条件1为false
if(条件3){
//代码5:条件1为false、条件3为true
//代码6:条件1为false
4. switch结构:
switch(g)
case 常量1://代码
break?case 常量2://代码
break;
.
default://代码