Page 1 of 1

use of continue statement

Posted: Sat Jan 14, 2017 2:51 am
by sulakshana
int x = 5;
while (x >= 0){
int y= 3;
while(y > 0) {
if (x<2) continue;
x--; y--;
System.out.println(x * y + " ");
}
}
How to guess the output of the following code?????
please help it compiles produce a output and goes infinitely....
But I can't understand this...

Re: use of continue statement

Posted: Sun Jan 15, 2017 12:10 am
by admin
You need to execute it step by step by jotting down the value of each variable at each step on a paper. When you practice more such examples, you will be able to do it mentally. There is no other way to solve such code problems.