Rewrite the following code fragment using a for loop instead of a while loop.

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

What will be an ideal response?


```
for(int i = 0; i < 50; i+=2)
System.out.println(i);
```

Computer Science & Information Technology

You might also like to view...

A visual cue to indicate the beginning of a paragraph is a(n) ________, which is extra space to the left of the paragraph

Fill in the blank(s) with correct word

Computer Science & Information Technology

Propose ways improve communication among stakeholders when face to face communication is not possible.

What will be an ideal response?

Computer Science & Information Technology

You must do the following before using an array:

a) declare then reference the array b) initialize then declare the array c) initialize then reference the array d) declare then initialize the array

Computer Science & Information Technology

Rearrange the structure of the Class element in Figure 15.4 so that it becomes possible to de?ne the following referential integrity: every student Id mentioned in a Class element references a student from the same document.

What will be an ideal response?

Computer Science & Information Technology