Java Community | Help. Code. Learn.JC|HCL
Java Community | Help. Code. Learn.โ€ข10mo agoโ€ข
17 replies
Bolo

Java While Loop Question

I am struggling with understanding what I am doing wrong when I answer this homework/quiz question. I am supposed to create a while loop that continuously prompts the user for int values until the user inputs a negative value. After the loop terminates, the program will display the largest value entered by the user.

The area I am struggling with is using the if/else if statements to correctly put the larger number in the variable named largest. I have spent hours trying to figure out what I am doing wrong, and would greatly appreciate any insight.
image.png
Was this page helpful?