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...
Which of the following best describes a patent?
A. A word, name, symbol, or device that the individual intends to use commercially and wants to distinguish from as unique B. A company secret or sensitive information C. Discovery or invention that is protected by law and cannot be used by others D. A copyrighted artwork or music
Computer Science & Information Technology
Exceptions can be particularly useful when you throw them from ____, which do not have a return type, so they have no other way to send information back to the calling method.
A. methods B. classes C. constructors D. finally blocks
Computer Science & Information Technology