File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question from jqplus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question from jqplus" Watch "Question from jqplus" New topic
Author

Question from jqplus

Sandhya Lever
Ranch Hand

Joined: Aug 15, 2005
Posts: 90
class Test
{
public static void main(String args[])
{
int c = 0;
A: for(int i = 0; i < 2; i++)
{
B: for(int j = 0; j < 2; j++)
{

C: for(int k = 0; k < 3; k++)
{
c++;
if(k>j) break;
}

}
}
System.out.println(c);
}
}


Options

Select 1 correct option.

7

8

9

10

11



Here the correct answer is 10.Please help me understand the output of this code.
Regards,
Sandhya


SCJP | SCWCD |SCBCD |SCDJWS |SCEA
Ramya Iyer
Ranch Hand

Joined: Jul 29, 2003
Posts: 66

[ October 06, 2005: Message edited by: Ramya Iyer ]
Sandhya Lever
Ranch Hand

Joined: Aug 15, 2005
Posts: 90
Thanks,Ramya
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question from jqplus