Evaluate each of the following expressions and write the final value for each su
ID: 3921000 • Letter: E
Question
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
Explanation / Answer
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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.