| Author |
continue blues
|
bobby chaurasia
Ranch Hand
Joined: Mar 30, 2002
Posts: 84
|
|
public static void main( String args[] ) { for(int ii = 0; ii < 3; ii++) { for(int jj = 3; jj <= 0; jj--) { if(ii == jj) continue; System.out.println(ii + " " + jj); } } } The correct answer the following code is The program does not print anything. I thought that each time ii == jj condition is true, it goes to next jj ie jj-- without printing ii and jj. But in other situations where ii is not equal to jj it should print ii & jj. Any clues ? [ April 20, 2002: Message edited by: bobby chaurasia ]
|
 |
Sharon Miller
Greenhorn
Joined: Mar 25, 2002
Posts: 10
|
|
HI Bobby, If you take a look at the test condition for the inner loop of the nested for loop, you will realize why nothing is printed. Perhaps if it is changed to the following The above code probably works as per your expectation. A suggestion would be to compile and execute the original code to validate your assumptions. -Sharmila
|
 |
 |
|
|
subject: continue blues
|
|
|