| Author |
Dan's Mock FLow Question
|
Vidyavathi saravanan
Ranch Hand
Joined: Sep 24, 2004
Posts: 34
|
|
Answer options: a. Prints: 0001 b. Prints: 012 c. Prints: 012012 d. Prints: 012345 e. Prints: 001122 f. Prints: 1112 g. Prints: 111222 h. Prints: 121212 i. Run-time error j. Compile-time error k. None of the above Answer is h. Could anyone please explain this to me? Thanks! (got rid of smiley in code portion) [ October 16, 2004: Message edited by: Barry Gaunt ]
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
Let's rewrite this a little: This is entirely equivalent to the previous code. It maybe easier to analyze now.
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
Peixiao Lin
Greenhorn
Joined: Oct 04, 2004
Posts: 28
|
|
|
do{}while(A) loop will iterate one more time than while(A){} loop. so in this case, the inside for loop will iterate 3 times. For each inside for loop iteration, the output is 12, so the final output is 121212
|
 |
Vipin Das
Ranch Hand
Joined: Jul 05, 2004
Posts: 47
|
|
|
|
 |
 |
|
|
subject: Dan's Mock FLow Question
|
|
|