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 29 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


jamesnevil303

  • Member
  • Posts: 337
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

It is believed that the Incas used anesthesia. Evidence supports the theory that shamans chewed cocoa leaves and drilled holes into the heads of patients (letting evil spirits escape), spitting into the wounds they made. The mixture of cocaine, saliva, and resin numbed the site enough to allow hours of drilling.

Did you know?

The modern decimal position system was the invention of the Hindus (around 800 AD), involving the placing of numerals to indicate their value (units, tens, hundreds, and so on).

Did you know?

Limit intake of red meat and dairy products made with whole milk. Choose skim milk, low-fat or fat-free dairy products. Limit fried food. Use healthy oils when cooking.

Did you know?

Certain topical medications such as clotrimazole and betamethasone are not approved for use in children younger than 12 years of age. They must be used very cautiously, as directed by a doctor, to treat any child. Children have a much greater response to topical steroid medications.

Did you know?

People with alcoholism are at a much greater risk of malnutrition than are other people and usually exhibit low levels of most vitamins (especially folic acid). This is because alcohol often takes the place of 50% of their daily intake of calories, with little nutritional value contained in it.

For a complete list of videos, visit our video library