What is wrong with this loop? How would you fix it?


int num = 1;
while (num <= 10 ) {
System.out.println("num = " + num);
}

It is an infinite loop. After the print statement, we need to increment num, as in the statement num++; .

Computer Science & Information Technology

You might also like to view...

If an Administrator performs a clean install of Windows Server 2016 on a new server, and then moves critical domain services over from an older server, what type of upgrade is being performed?

A. Server role migration B. In-place upgrade C. Standard upgrade D. Microsoft Server Transfer

Computer Science & Information Technology

The Emacs editor is:

a: a line oriented editor b: a screen oriented editor c: supported in some of the UNIX installations d: a text formatter e: b and c

Computer Science & Information Technology