• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

please help

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class Checklist
{
public static void main(String args[])
{
outer:
for(int i=0;i<3;i++)
{
for(int j=0;j<2;j++)
{
if(i==j)
{
continue outer;
}
System.out.println(i +" "+j);
}
}
}
}

output:1 0
2 0
2 1
explian it

thanks
 
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i = 0 (1st for-loop)
j = 0 (2nd for-loop)
i == j, go to the outer label
i = 1
j = 0
i != j, output : 1 0
j = 1
i == j, go to the outer label
i = 2
j = 0
i != j, output : 2 0
j = 1
i != j, output : 2 1
 
reply
    Bookmark Topic Watch Topic
  • New Topic