Question: What is the value of each variable after the if statement? a. int n = 1; int k = 2; int r = n; if

What is the value of each variable after the if statement?


a. int n = 1; int k = 2; int r = n;
if (k < n) { r = k; }
b. int n = 1; int k = 2; int r;
if (n < k) { r = k; }
else { r = k + n; }
c. int n = 1; int k = 2; int r = k;
if (r < k) { n = r; }
else { k = n; }
d. int n = 1; int k = 2; int r = 3;
if (r < n + k) { r = 2 * n; }
else { k = 2 * r; }

Step by Step Solution

3.56 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer an1 k2 rn r 1 ifk if2 1 which is false it wont proceed further final values are n1 k2 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Concepts Late Objects Questions!