Write a Java statement or a set of Java statements to accomplish the tasks:
Print the integers from 1 to 20, using a while loop and the counter variable i. Assume that the variable i has been declared, but not initialized. Print only five integers per line. [Hint: Use the calculation i % 5. When the value of this expression is 0, print a newline character; otherwise, print a tab character. Assume that this code is an application. Use the System.out.println() method to output the newline character, and use the Sys- tem.out.print('\t') method to output the tab character.]
```
i = 1;
while (i <= 20) {
System.out.print(i);
if (i % 5 == 0) {
System.out.println();
}
else {
System.out.print('\t');
}
++i;
}
```
You might also like to view...
Answer the following statements true (T) or false (F)
1. The following function does not throw any unhandled exceptions void f1( ) throw ( ); 2. Functions that might throw an exception must have a throw list. 3. Functions may potentially throw at most one exception. 4. If a function throws an exception, it must be caught inside that function. 5. It is legal to have a catch block with no parameter.
The ability to pass a structure variable and its members as one unit is the not an advantage of using a structure.
Answer the following statement true (T) or false (F)
?A(n) _____ is a comparison of vendor options conducted in a computing environment and with a workload that matches its intended operating conditions.
Fill in the blank(s) with the appropriate word(s).
The first part of a URL is called the:
a. Server name b. Scheme c. Path d. File name