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

Author Question: When you run the following program, what will happen?public class Test extends Thread { public ... (Read 36 times)

bio_gurl

  • Hero Member
  • *****
  • Posts: 524

Question 1

You can use the ________ method to force one thread to wait for another thread to finish.
◦ sleep(long milliseconds)
◦ join()
◦ stop()
◦ yield()
◦ suspend()

Question 2

When you run the following program, what will happen?

public class Test extends Thread {
public static void main(String[] args) {
Test t = new Test();
t.start();
t.start();
}

public void run() {
System.out.println("test");
}
}

◦ The program displays test twice.
◦ The program displays test once.
◦ Nothing is displayed.
◦ An illegal java.lang.IllegalThreadStateException may be thrown because you just started thread and thread might have not yet finished before you start it again.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

Carliemb17

  • Sr. Member
  • ****
  • Posts: 325
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 39% of students answer this correctly




bio_gurl

  • Member
  • Posts: 524
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


xoxo123

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

 

Did you know?

Approximately 15–25% of recognized pregnancies end in miscarriage. However, many miscarriages often occur before a woman even knows she is pregnant.

Did you know?

Normal urine is sterile. It contains fluids, salts, and waste products. It is free of bacteria, viruses, and fungi.

Did you know?

Ether was used widely for surgeries but became less popular because of its flammability and its tendency to cause vomiting. In England, it was quickly replaced by chloroform, but this agent caused many deaths and lost popularity.

Did you know?

Aspirin may benefit 11 different cancers, including those of the colon, pancreas, lungs, prostate, breasts, and leukemia.

Did you know?

The senior population grows every year. Seniors older than 65 years of age now comprise more than 13% of the total population. However, women outlive men. In the 85-and-over age group, there are only 45 men to every 100 women.

For a complete list of videos, visit our video library