This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes continue blues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "continue blues" Watch "continue blues" New topic
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
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: continue blues
 
jQuery in Action, 3rd edition