• Post Reply Bookmark Topic Watch Topic
  • New Topic

flow controls  RSS feed

 
Hasitha Randika
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the meaning of outer
what will happen when
outer: for(int i = 0;i < 2; i++) line executes
what will happen when
continue outer; line executes

class A{
public static void main(String ar[]){
outer: for(int i = 0;i < 2; i++){
for(int j = 0;j < 3;j++){
if(i==j)
continue outer;
System.out.println("i="+i+" j="+j);
}
}
}
}
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Hasitha_Randika,"

I need you to take another look at the JavaRanch Naming Policy, and note that a space must separate your first and last name. Replace the underscore with a space, and you should be fine. You can edit your display name here. Thanks!

With respect to your question, the identifier followed by a colon is a label that can be used with a loop's "break" or "continue" statements. See The infamous 'goto' section from Thinking in Java.
[ September 17, 2007: Message edited by: marc weber ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!