Find the error(s) in the following code. This code should append the numbers from 10 down to 1 to outputJTextArea.
```
1 int counter = 10;
2
3 do
4 {
5 outputJTextArea.append( counter + "\n" );
6 }
7 while ( counter > 1 );
8
9 --counter;
```
Line 9 should be placed within the body of the do…while statement between lines 5 and 6. The code above causes an infinite loop—counter is never decremented within the do…while statement, so the loop continuation condition never becomes false. Also, once the decrement statement is moved into the body of the loop, there will be an off-by-one- error. The condition should be either counter >= 1 or counter > 0. The corrected code is dis- played below.
```
1 int counter = 10;
2
3 do
4 {
5 outputJTextArea.append( counter + "\n" );
6 --counter;
7 }
8 while ( counter >= 1 );
```
You might also like to view...
Which are true statements about STP PortFast mode?
A) The port bypasses the normal STP startup process and enters forwarding mode immediately. B) Special BPDUs are generated to notify the other switches that the port is an access port and any switches connected to it should cause the port to be disabled. C) It should be used on all switch uplink ports to speed convergence in case of a network failure. D) It starts the generation of STP TCN BPDU generation in port up/down conditions.
Trace through the binary search algorithm in findInSortedList given the following input.
What will be an ideal response?