5、打印输出及格的分数,则就不需要else语句了。 2、if语句的嵌套形式if(<条件1>) <语句块1>;elseif(<条件2>) <语句块2>;elseif(<条件3>)当对于多个条件进行判断用if语句的一般形式就不行了,比如根据学生的成绩评定若干等级的问题。[java] viewplaincopy1.public class TestIF2{ 2. public static void main(String[] args){ 3. int i = 88; 4. if(i
6、 >=90) 5. System.out.println("优秀"); 1. else if (i >=80) 2. System.out.println("良好"); 3. else if (i>=70) 4. System.out.println("中等"); 5. else if (i>=60) 6. System.out.println("及格"); 7. else 8. System.