What is the result?

Given:
public class Natural {
private int i;
void disp() {
while (i <= 5) {
for (int i=1; i <=5;) {
System.out.print(i + " ");
i++;
}
i++;
}
}
public static void main(String[] args) {
new Natural().disp();
}
}
What is the result?
A. Prints 1 2 3 4 5 once
B. Prints 1 3 5 once
C. Prints 1 2 3 4 5 five times
D. Prints 1 2 3 4 5 six times
E. Compilation fails

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.