ICSE Class 10 Computer Applications Question 38 of 76

Revising Basic Java Concepts — Question 42

Back to all questions
42
Question

Question 23

What is nested loop ?

Answer

A loop may contain another loop in its body. This form of a loop is called nested loop. In a nested loop, the inner loop must terminate before the outer loop.

For example:

for(int i = 0; i < 5; i ++) {
    for(int j = 0; j < i; j++)  {
        System.out.print(j + ' ');
    }
    System.out.println();
}