public static void main(String[] args) { Thread t = new MyThread(); Thread u = new Thread(new MyRunnable()); } 1 2 3 04 t.start(); u.start(); t.join(); u.join();

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter11: Operating Systems
Section: Chapter Questions
Problem 14VE
icon
Related questions
Question

Please answer the follwoing regarding the java code:

When looking at the code below, assume that the MyThread and MyRunnable classes are correctly implemented in other files. How many threads are there in the program shown below? (Be careful to consider ALL the threads!)

 

public static void main(String[] args) {
Thread t = new MyThread();
Thread u = new Thread (new MyRunnable());
}
1
2
3
04
t.start();
u.start();
t.join();
u.join();
Transcribed Image Text:public static void main(String[] args) { Thread t = new MyThread(); Thread u = new Thread (new MyRunnable()); } 1 2 3 04 t.start(); u.start(); t.join(); u.join();
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Avoiding deadlock
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning