Week 9 : Java Threads solution

$14.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Question 1 – Thread Creation

Create a LoudHailer class that continually broadcasts (i.e. prints) a given word, and then takes a deep breath (i.e. sleeps) for 1 second.

Have 3 LoudHailer instances, each running on a separate thread, to broadcast the words “Good”, “Morning”, “Kolkata” respectively.

Question 2 – Thread Synchronisation

Using synchonisation mechanisms, have the 3 threads from Question #1 co-operate, so that “Good Morning Kolkata” is broadcast in sequence every time.

Question 3 – Thread Liveness

Simulate a long synchronised block by having the thread sleep for 3 seconds within the synchronised block / synchronised method.