• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

for loop question especially for you.

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,you might think i am posting a lot of questions expecting you to answer,well the thing is i am posting the questions which completely confused me..so just to check whether it confuses others or not Well here it goes:
What does the following code print(Note:There may be Multiple answers or a single answer)
outer:
for ( int i = 0 ; i<3 ; i++ )
{
for ( int j = 0 ; j<2 ; j++ )
{
if ( i == j )
{
continue outer ;
}
System.out.println( "i=" + i + " , j=" + j ) ;
}
}
a)i=1 , j=0
b)continue cannot be used with for loop.
c)i=2 , j=0
d)It won't compile.
e)i=2 , j=1
f)It will compile but won't print anything.
[This message has been edited by Surya B (edited July 31, 2000).]
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Answer is a,c,e
Very good question. It may appear in the exam.
 
reply
    Bookmark Topic Watch Topic
  • New Topic