Karu Raj

Ranch Hand

Posts: 481

Kalyana Sundaram

Ranch Hand

Posts: 94

posted 12 years ago

Initially when I=0 and j=0

In the next iteration of the outter loop, we have

i=1 and j=0, this time the first

Output at this point is

And the value of

Now moving to next iteration of outter loop

i=2 and j=0, this time also the first

Output at this point is

Now sum is 9+2 =11 greater than 10, so the second

Hope this helps :-)

**if(j==i) break;**is executed and so control breaks out of the inner loop.In the next iteration of the outter loop, we have

i=1 and j=0, this time the first

**if**will not get exeuted and control proceeds to execute the**System.out.println()**Output at this point is

*Element[1, 0]: 2*And the value of

*sum is 2*, which is less than 10, so second**if**is not executedNow moving to next iteration of outter loop

i=2 and j=0, this time also the first

**if**will not get exeuted and control proceeds to execute the**System.out.println()**Output at this point is

*Element[2, 0]: 9*Now sum is 9+2 =11 greater than 10, so the second

**if**gets executed and comes out of the scope defined by the label**outer:**Hope this helps :-)

Only those who will risk going too far can possibly find out how far one can go !!!

Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |