java,if else if else if 成立时只会走其中一个路径,不成立时才会一个一个走
public int f3() {if (2 <=1) {return 0;} else if (2 == 3) {return 2;} else if (3 == 3) {return 3;}return 4;}//输出3 public int f4() {if (1 == 1) {if (2 == 3) {return 1;} else if (3 == 4) {return 1;}} else if (2 == 2) {return 2;} else if (3 == 3) {return 3;}return 4;}//4
if else if else if
1遇到第一个条件为true时则后面的else if不再执行( 即使后面的几个都符合条件)
2如果前面的if 、else if 为false时才会执行下一个else if ,
2.1如果当前else if为true则不再执行后面的else if,
2.2如果当前else if为false则继续执行后面的else if