• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

flow controls

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
}
}
}
}
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
This is awkward. I've grown a second evil head. I'm going to need a machete and a tiny ad ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic