• 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
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Question from jqplus

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ October 06, 2005: Message edited by: Ramya Iyer ]
 
Sandhya Lever
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,Ramya
 
reply
    Bookmark Topic Watch Topic
  • New Topic