Identify and correct the error(s) below:

This code should display in a JTextArea all integers from 100 to 1 in decreasing order.
```
1 String output;
2
3 for ( int counter = 100; counter >= 1; counter++ )
4 {
5 output += counter;
6 }
7
8 displayTextArea.setText( output );
```

The variable output (line 1) must be initialized. The third expression in the for header should read “counter--”
```
1 String output = "";
2
3 for ( int counter = 100; counter >= 1; counter-- )
4 {
5 output += counter + "\n";
6 }
7
8 displayTextArea.setText( output );
```

Computer Science & Information Technology

You might also like to view...

You can use File Explorer to begin installation of a new software program

Indicate whether the statement is true or false

Computer Science & Information Technology

Why would you set a default value for a field?

What will be an ideal response?

Computer Science & Information Technology