This topic contains a solution. Click here to go to the answer

Author Question: Given the following code, which set of code can be used to replace the comment so that the program ... (Read 27 times)

hbsimmons88

  • Hero Member
  • *****
  • Posts: 526
Given the following code, which set of code can be used to replace the comment so that the program displays time to the console every second?

import java.applet.*;
import java.util.*;

public class Test extends Applet implements Runnable {
public void init() {
Thread t = new Thread(this);
t.start();
}

public void run() {
for(; ;) {
//display time every second
System.out.println(new Date().toString());
}
}
}

◦ try { sleep(1000); } catch(InterruptedException e) { }
◦ try { Thread.sleep(1000); } catch(RuntimeException e) { }
◦ try { t.sleep(1000); } catch(InterruptedException e) { }
◦ try { Thread.sleep(1000); } catch(InterruptedException e) { }


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by hbsimmons88 on May 6, 2020

Heffejeff

  • Sr. Member
  • ****
  • Posts: 336
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 64% of students answer this correctly




hbsimmons88

  • Member
  • Posts: 526
Reply 2 on: May 6, 2020
Excellent


billybob123

  • Member
  • Posts: 336
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

To prove that stomach ulcers were caused by bacteria and not by stress, a researcher consumed an entire laboratory beaker full of bacterial culture. After this, he did indeed develop stomach ulcers, and won the Nobel Prize for his discovery.

Did you know?

Parkinson's disease is both chronic and progressive. This means that it persists over a long period of time and that its symptoms grow worse over time.

Did you know?

For high blood pressure (hypertension), a new class of drug, called a vasopeptidase blocker (inhibitor), has been developed. It decreases blood pressure by simultaneously dilating the peripheral arteries and increasing the body's loss of salt.

Did you know?

The largest baby ever born weighed more than 23 pounds but died just 11 hours after his birth in 1879. The largest surviving baby was born in October 2009 in Sumatra, Indonesia, and weighed an astounding 19.2 pounds at birth.

Did you know?

In 1864, the first barbiturate (barbituric acid) was synthesized.

For a complete list of videos, visit our video library