public class demo {
public static void main(String[] args) {
boolean examIsDone = true;
int score = 65;
if (examIsDone)
if (score >= 90)System.out.println("A ,Excellent");
else if (score >= 80)
System.out.println("B ,Good");
else if (score >= 70)
System.out.println("C ,Middle");
else if (score >= 60)
System.out.println("D ,Pass");
else
System.out.println("E ,Fail");
System.out.println("Done is Done");
}
}
1), it can not be omitted parentheses after the if, the final value of the expression in parentheses must return a Boolean value
2) If only one statement in vivo conditions need to be performed, then if the back brace can be omitted, but this is a very bad programming practice.
3), for a given if, else statement is optional, else if statement is optional
4), when else and else if occur simultaneously, else must appear after the else if
5) where there are multiple else if statements occur simultaneously, so if there is a statement of expression else if the test is successful, it will ignore all other else if and else branches.
6) If more than if occurs, only one else's situation, else clause is attributable to the innermost if statement