Evaluate each of the following expressions and write the fin

Evaluate each of the following expressions and write the final value for each such that each value clearly indicates the type of value. Always use the initial values of the variables as shown.

int j = 25;
int k = 34;
String s = \"John Smith\";

a) ____________ k / j
b) ____________s.charAt( 6 )
c) ____________s.substring(3, 8)
d) ____________s.length();
e) ____________\"David\".equals(\"david\")
f) ____________k > j && k < 34
g) ____________k % j
h) ____________j + k / 4
i) ____________2 + 4 + s
j) ____________ s + 2 + 4

For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac).

Solution

Answer:

a) ____________ k / j --------- Answer: 1
b) ____________s.charAt( 6 ) --------- Answer: m
c) ____________s.substring(3, 8)   --------- Answer: n Smi
d) ____________s.length();   --------- Answer: 10
e) ____________\"David\".equals(\"david\")   --------- Answer: false
f) ____________k > j && k < 34   --------- Answer: false
g) ____________k % j   --------- Answer: 9
h) ____________j + k / 4   --------- Answer: 33
i) ____________2 + 4 + s    --------- Answer: 6John Smith
j) ____________ s + 2 + 4   --------- Answer: John Smith24

Evaluate each of the following expressions and write the final value for each such that each value clearly indicates the type of value. Always use the initial v

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site