Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Consider this code.

 
Sanket Modi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider this code.
public class Test {
public static void main(String[] args){
for(int j = 0; j < 1 ; j++)
{
if (j < 1) continue innerLoop;
innerLoop: for(int i = 0; i < 2; i++)
{
System.out.println("Hello world");
}
}
}
}
What is the result of attempting to compile and run this.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sanket Modi:
... What is the result of attempting to compile and run this.

Fortunately, Sun provides free tools (javac and java) for testing this.

Do you have a Java JDK installed on your machine?
 
Gaurav Joshi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sanket Modi,





The above code will not complie as Label are like identifiers and the statement using these label(break or continue) must be in the scope of the label
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic