Pages

Tuesday, October 4, 2016

You complete me - stop (Java)

Use the code presented in Timer (Java) and add some code to the partially complete method below to complete it. (Did I have you at hello?)
/*
 * pause does nothing for timeInMs millisends
 * before returning control to the code that
 * called pause. Internally, pause uses a
 * Timer object to wait the specified
 * amount of time before completing.
 */
void pause(long timeInMs) {
  // Missing code starts here:

  // Missing code ends here.
  while (timer.elapsedTimeInMs() < timeInMs);
}