# Java: Boolean Expression Answers

Name ______________________

Assume the following:

    int i, j, k;
    boolean b;
    k = 10;
    j = 6;
    b = true;

Give the values of the following expressions, or illegal.

1 | true | b
2 | false | !b
3 | true | !!!!!!b
4 | true | b || !b
5 | false | b && !b
6 | false | b ^ true
7 | illegal | b++
8 | illegal | b = 1
9 | false | b = 1 > 2
10 | true | true || 1234/26%3==1
11 | true | true | 1234/26%3==1
12 | false | !b & (j < 100)
13 | illegal | k > j > 3
14 | illegal | k > j && > 3
15 | true | k > j && k > 3
16 | illegal | b ||= false
17 | true | b |= false
18 | 10 | k = (k>j)?k:j+1
19 | false | (b && !b) | (!b & b)
20 | illegal | 1 > 2 > 3
21 | true | b = j > 0 && (i = k/j)!=0