use of continue statement

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
sulakshana
Posts: 14
Joined: Thu Dec 22, 2016 8:55 pm
Contact:

use of continue statement

Post 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...

admin
Site Admin
Posts: 10043
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: use of continue statement

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests