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 26 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
:D TYSM


jackie

  • Member
  • Posts: 324
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

Street names for barbiturates include reds, red devils, yellow jackets, blue heavens, Christmas trees, and rainbows. They are commonly referred to as downers.

Did you know?

All patients with hyperparathyroidism will develop osteoporosis. The parathyroid glands maintain blood calcium within the normal range. All patients with this disease will continue to lose calcium from their bones every day, and there is no way to prevent the development of osteoporosis as a result.

Did you know?

Russia has the highest death rate from cardiovascular disease followed by the Ukraine, Romania, Hungary, and Poland.

Did you know?

Acetaminophen (Tylenol) in overdose can seriously damage the liver. It should never be taken by people who use alcohol heavily; it can result in severe liver damage and even a condition requiring a liver transplant.

Did you know?

After a vasectomy, it takes about 12 ejaculations to clear out sperm that were already beyond the blocked area.

For a complete list of videos, visit our video library