| Author |
continue statement
|
ketki kalkar
Ranch Hand
Joined: May 09, 2007
Posts: 36
|
posted

0
|
Which all lines are part of the output when the following code is compiled and run. Select all correct answers. public class test { public static void main(String args[]) { outer: for(int i = 0; i < 3; i++) for(int j = 3; j >= 0; j--) { if(i == j) continue outer; System.out.println(i + " " + j); } } } } a. 0 0 b. 0 1 c. 0 2 d. 0 3 e. 1 0 f. 1 1 g. 1 2 h. 1 3 i. 2 0 j. 2 1 k. 2 2 l. 2 3 m. 3 0 n. 3 1 o. 3 2 p. 3 3 answer is b,c,d,g,h,l. How?
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Compile and run with these println statements added to the code.
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
ram shah
Greenhorn
Joined: Jun 02, 2007
Posts: 28
|
posted

0
|
I think the output should be in the order, d,c,b,h,g,l as i is incremented and j is decremented. Am i correct? I'm at work. so, can't compile & check.
|
 |
Gautam Arora
Greenhorn
Joined: Jan 16, 2007
Posts: 4
|
|
I think the question asks you to enter select all correct options and not the specific order (though the order you have given is correct). Just curious, why cant you compile a program at work. I would guess that you are a programmer and should have access to javac and java
|
Regards,<br />Gautam Arora<br />100% Geek
|
 |
 |
|
|
subject: continue statement
|
|
|