Question: urgently solution required for Q1-C Question 1.C: Programming: The program in which we create objects and threads related to five time prayers: Fajr. Zuhur, Asar,

urgently solution required for Q1-C
Question 1.C: Programming: The program in which we create objects and threads related to five time prayers: Fajr. Zuhur, Asar, Maghrib and Isha. The Program consists of three classes: Callme, Caller, and Prayers. Complete program is given below: class Callme{ void call(String msg) { System.out.print("C" + msg); try { Thread.sleep(1000); } catch(InterruptedException e) { System.out.println("Interrupted"); } System.out.println("1"); } class Caller implements Runnable { String msg; Callme target; Threadt; public Caller(Callme targ, Strings) { target = targ msg = s; t = new Thread(this); t.start(); } public void run() { target.call(msg); } class Prayers { public static void main(String argsl) { Callme target = new Callme(); Caller ob1 = new Caller(target, "Fajar"); Caller ob2 = new Caller(target, "Zuhr"); Caller ob3 = new Caller(target, "Asar"); Caller ob4 = new Caller(target, "Maghrib"); Caller ob5 = new Caller(target, "Isha"); try { ob1.t.join(); ob2.t.join(; ob3.t.join(); ob4.t.join(); ob5.t.join: } catch (InterruptedException e) { System.out.println("Interrupted"); } The Output of the above program is as follows: C:\Users\janna\Desktop\Programming in Java\Source code\Final Exam>java Prayers [Maghrib[Isha[Zuhr[Fajar[Asar] There is a race condition in above program that's why the output is not in sequential order. What need to be done in the above program so that we can get the desired output as shown below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
