February 2014
Beginner
1248 pages
62h 25m
English
Now suppose we wish to ensure that either or both of two conditions are true before we choose a certain path of execution. In this case, we use the || (conditional OR) operator, as in the following program segment:
if ((semesterAverage >= 90) || (finalExam >= 90)) System.out.println ("Student grade is A");
This statement also contains two simple conditions. The condition semesterAverage >= 90 evaluates to determine whether the student deserves an A in the course because of a solid performance throughout the semester. The condition finalExam >= 90 evaluates to determine whether the student deserves an A in the course because of an outstanding performance on the final exam. The if ...
Read now
Unlock full access