Question: Given the following code: public void countDown ( int leadTime, String message ) { System.out.println ( leadTime + . . . ) ;

Given the following code:
public void countDown(int leadTime, String message)
{
System.out.println(leadTime +"...");
if (leadTime <5)
countDown(leadTime +1, message);
else
System.out.println(message);
}
If client code calls countDown(0,"GAMEOVER"), what is the order of the subsequent method calls?
Incorrect answer:
countDown(1,"GAMEOVER"), countDown(2,"GAMEOVER"), countDown(3,"GAMEOVER"), countDown(4,"GAMEOVER")
Correct Answer:
countDown(1,"GAMEOVER"), countDown(2,"GAMEOVER"), countDown(3,"GAMEOVER"), countDown(4,"GAMEOVER"), countDown(5,"GAMEOVER")
countDown(1,"GAMEOVER"), countDown(2,"GAMEOVER"), countDown(3,"GAMEOVER"), countDown(4,"GAMEOVER"), countDown(5,"GAMEOVER")
, Not Selected
countDown(4,"GAMEOVER"), countDown(3,"GAMEOVER"), countDown(2,"GAMEOVER"), countDown(1,"GAMEOVER"), countDown(0,"GAMEOVER")
, Not Selected
countDown(4,"GAMEOVER"), countDown(3,"GAMEOVER"), countDown(2,"GAMEOVER"), countDown(1,"GAMEOVER")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!