Home
Pre-Lab
In-Lab
Post-Lab
|
Logical OR
The following code segment ensures that either or both of two conditions are true
before we choose a certain path of execution.
if( ( semesterAverage >= 90 ) || ( finalExam >= 90 ) )
System.out.println( "Student grade is "A" );
In the above if statement the condition [semesterAverage >= 90] evaluates
to determine whether the student deserves an "A" in the course because of
a solid performance thoroughout the semester. The condition [finalExam >= 90]
evaluates to determine whether the student deserves an "A" in the course
because of an outstanding performance in the final exam. The only time the message
["Student grade is A"] is not printed is when both of the simple conditions are false.

|