The following code compiled, but while running it the program appears to hang (e.g. nothing happens). This is a sign that there may be an infinite loop. What part of this code fragment may be causing an infinite loop?

```
while(i < 50); {
System.out.println(i);
i+=2;
}
```


There is a misplaced semi-colon after the while statement. This causes the loop to have an empty body,
meaning that the i variable is never updated. This leads to an infinite loop.

Computer Science & Information Technology

You might also like to view...

Word and Excel files are compressed by Access when you attach them

Indicate whether the statement is true or false

Computer Science & Information Technology

The AutoComplete feature automatically completes an entry based on previous entries in a column. _________________________  

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Graphic design and advertising do not help drive the economy.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

?A(n) ____ reference identifies a cell by its location in relation to other cells and changes when a formula is moved or copied.

A. ?absolute B. ?relative C. ?template D. ?vector

Computer Science & Information Technology