Question #145310

Suppose that score is an int variable. Consider the following if statements:
if (score >= 90);
System.out.println("Discount = 10%");
a. What is the output if the value of score is 95? Justify your answer.
b. What is the output if the value of score is 85? Justify your answer.

Expert's answer

a. Output is "Discount = 10%"

b. Output is the same - "Discount = 10%"


println is not inside of the "if" operator scope (not included in curly brackets) so the "if" condition doesn't impact execution of println.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS