Find the error(s) below:
Assume that the variable counter is declared and initialized to 1000. The loop should iterate from 1000 to 1.
```
while ( counter > 0 )
{
displayJLabel.setText( String.valueOf( counter ) );
counter++;
}
```
This code results in an infinite loop because the loop-continuation condition never becomes false. The loop should count down from 1000 to 1, so a decrement should be used. Change the ++ operator on line 4 to a -- operator. The correct code is:
```
while ( counter > 0 )
{
displayJLabel.setText( String.valueOf( counter ) );
counter--;
}
```
You might also like to view...
The stream that is used for output to the screen is called ___________.
Fill in the blank(s) with the appropriate word(s).
To form a circle, the syntax of an arc must be:
a) DrawArc( p, 1, 1, 1, 1, 0, Math.PI ) b) DrawArc( p, 1, 1, 1, 1, 360, 0 ) c) DrawArc( p, 1, 1, 1, 1, 0, 360 ) d) DrawArc( p, 1, 1, 1, 1, 360, Math.PI ) e) None of the above
What is the scope of the variable pen on line 6?
``` ``` a. global b. local c. value d. reference
You can view comments and accept or reject changes in the ________ pane
A) Revisions B) Review C) Comments D) Track Changes