int i = 2;
int j = 3;
int k = 4;
int m, n;
Determine the value assigned to the variable in each of the following assignment statements.
a) m = i + j * k; |
e) m = i + j % k; |
b) m = (i + j) * k; | f) m = (i + j) % k; |
c) m = i + j / k; | g) m = i + j * k + 2; |
d) m = (i + j) / k; | h) m = i + j * (k + 2); |
2) Write a Java expression to compute the following:
a) i2 + 4 i j
b) The remainder of
3) Suppose we have the following declarations:
int i = 2;
int j = 3;
Predict what will be displayed by each of the following Java statements:
a) new Text( i + j + " is the sum", 50, 50, canvas );
b) new Text( "The sum is " + i + j , 50, 50, canvas );