File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

for loop question especially for you.

 
Surya B
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • 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).]
 
sasank manohar
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Answer is a,c,e
Very good question. It may appear in the exam.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic