Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What the answer ? You should implement four threads in Java. The execution should be in this order: Thread 2, Thread 3 and finally Thread
What the answer ?
You should implement four threads in Java. The execution should be in this order: Thread 2, Thread 3 and finally Thread 1. Thread 0 (3 marks) - Used to call other threads - You have to use join( ) method Thread 1 (2 marks) - Should be implemented using extends Thread - Thread class (extends Thread) - You have to use for loop - Priority Max Thread 2 (2 marks) - Should be implemented using Runnable interface - You have to use for loop - You have to use sleep( method (one second interval inside the loop) - Priority Normal Thread 3 (2 marks) Should be implemented using extends Thread - Thread class (extends Thread) - You have to use for loop - You have to use sleep0 method (4 seconds interval before the previous thread) - Thread Priority 7 The output should be as following: 1 Thread 2 (University number) 2 Thread 2 (University number) 3 Thread 2 (University number) 4 Thread 2 (University number) 1 Thread 3 (University number, Thread Priority) 2 Thread 3 (University number, Thread Priority) 3 Thread 3 (University number, Thread Priority) 4 Thread 3 (University number, Thread Priority) 1 Thread 1 (University number, Thread Priority) 2 Thread 1 (University number, Thread Priority) 3 Thread 1 (University number, Thread Priority) Note: You should replace "University number" with your university number. Also, you should replace Thread Priority with that thread priority using the suitable method to get it, for example: Failure to do the aforementioned will results on deducting marks. 1 Thread 3(435101927,7) 2 Thread 3(435101927,7) 3 Thread 3(435101927,7) 4 Thread 3(435101927,7) Two students submitting the same output/code will be rejected (Both students will get Zero as a result). Make sure you do not pass your answer to any student. - Take screenshots of the answer place the Code you used and the obtained 0utput from Java program. - Put them in word document and save it as PDF file and submit itStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started