Java Reference
In-Depth Information
SR 5.4
Assuming the given declarations, the values are: a. true, b. true,
c. false, d. true, e. true, f. true, g. true, h. false, i. true, j. true
SR 5.5
A truth table is a table that shows all possible results of a boolean expres-
sion, given all possible combinations of variables and conditions.
SR 5.6
The truth table is:
(value > 0)
|| !done
done
!done
value > 0
true
true
false
true
true
false
true
true
false
true
false
false
false
false
true
true
SR 5.7
The truth table is:
c1 && !c2 ||
!c1 && c2
c1
c2
!c1
!c2
c1 && !c2
!c1 && c2
true
true
false
false
false
false
false
true
false
false
true
true
false
true
false
true
true
false
false
true
true
false
false
true
true
false
false
false
5.2 The if Statement
SR 5.8
Based on the given assumptions, the output would be:
a. red white yellow
b. blue yellow
c. blue yellow
SR 5.9
A block statement groups several statements together. We use them to
define the body of an if statement or loop when we want to do multiple
things based on the boolean condition.
SR 5.10
A nested if occurs when the statement inside an if or else clause is
an if statement. A nested if lets the programmer make a series of deci-
sions. Similarly, a nested loop is a loop within a loop.
Search WWH ::




Custom Search