aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes for loop question especially for you. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "for loop question especially for you." Watch "for loop question especially for you." New topic
Author

for loop question especially for you.

Surya B
Ranch Hand

Joined: May 10, 2000
Posts: 98
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

Joined: Feb 14, 2008
Posts: 186

Answer is a,c,e
Very good question. It may appear in the exam.

"SCJP5 | SCWCD5| DEVELOPER"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: for loop question especially for you.