Answer to Question #235162 in Java | JSP | JSF for Newbie

Question #235162
What does the following code output?

int x=8;
int y=2;
while (x>8) {

x--;
y+=2;
}

System.out.println (y)
1
Expert's answer
2021-09-09T06:39:46-0400

The condition in the while loop is false (x > 8 is false), so y does not change, and the output is 2.


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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS