What is the result of the following code? Assume that there is no text in display- JTextArea when this code begins executing.

```
1 int y;
2 int x = 1;
3
4 do {
5 y = x * x;
6 displayJTextArea.append( y + "\n" );
7 x += 1;
8 } while ( x <= 10 );
```

The do…while statement will loop 10 times, each time appending the square of variable counter’s value to displayJTextArea. Each value appears on a separate line. When this loop completes, displayJTextArea will contain the squares of the numbers from 1 to 10 (that is, the values 1, 4, 9, 16, 25, 36, 49, 64, 81, 100).

Computer Science & Information Technology

You might also like to view...

The ________ command divides a window into multiple panes

Fill in the blank(s) with correct word

Computer Science & Information Technology

What is the output of the following code?

float x = 2.3, y = 4.7, z = 1.4; if (!(x < 7) && (y >= z)) cout << x << ” “ << y; else cout << y << “ “ << z;

Computer Science & Information Technology