image is clearQuestion 3: Complete the Java code below, using wait() / notify appropriately, so that the correct total is printed i.e., after the count is done. (6 marks) Sune (6) trye her wait () 3 catch (p.ee) { e.prints 😉 public class Test public static void main(String[] args) { TotalRunr = new TotalRun(); Thread t = new Thread(); t.start(): while (angem ent. n c = 6. tofan 1) Ed.ntti Ahmet Dakik Dalyen. t-get instawe. notify : Synchronical Care System.out.println( “Total is: ” + t.total ): Pratch (latenspelly class TotalRun implements Runnable int n = 0, total = 0; @Override public void run() { try & while Coca total) & wait () 2 Thend. sleep (100); } while (n=1000) (total += n++) watake shape ang! Ben I Sun (this) & while . notify(); Synamnized Lithis) { E KRYES cakú (Tatrybel B xoptanz e) ece pod Tunes] Show transcribed image text Question 3: Complete the Java code below, using wait() / notify appropriately, so that the correct total is printed i.e., after the count is done. (6 marks) Sune (6) trye her wait () 3 catch (p.ee) { e.prints 😉 public class Test public static void main(String[] args) { TotalRunr = new TotalRun(); Thread t = new Thread(); t.start(): while (angem ent. n c = 6. tofan 1) Ed.ntti Ahmet Dakik Dalyen. t-get instawe. notify : Synchronical Care System.out.println( “Total is: ” + t.total ): Pratch (latenspelly class TotalRun implements Runnable int n = 0, total = 0; @Override public void run() { try & while Coca total) & wait () 2 Thend. sleep (100); } while (n=1000) (total += n++) watake shape ang! Ben I Sun (this) & while . notify(); Synamnized Lithis) { E KRYES cakú (Tatrybel B xoptanz e) ece pod Tunes]
Expert Answer
Answer to Question 3: Complete the Java code below, using wait() / notify appropriately, so that the correct total is printed i.e….