diff --git a/Inter7.class b/Inter7.class new file mode 100644 index 0000000..11c4b36 Binary files /dev/null and b/Inter7.class differ diff --git a/Inter7.java b/Inter7.java new file mode 100644 index 0000000..1af18cf --- /dev/null +++ b/Inter7.java @@ -0,0 +1,27 @@ +// 7. Write a java program for inter thread communication using wait(), notify(), notifyall() +class TotalEarnings extends Thread{ + int total = 0; + public void run(){ + synchronized(this){ + for(int i=1; i<=10;i++){ + total = total + 10; + } + this.notify(); + } + } +} + + +public class Inter7 { + public static void main(String[] args) throws InterruptedException{ + TotalEarnings te = new TotalEarnings(); + te.start(); + synchronized(te){ + te.wait(); + System.out.println("Total earnings: "+te.total); + } + } +} + + + \ No newline at end of file diff --git a/TotalEarnings.class b/TotalEarnings.class new file mode 100644 index 0000000..2560e4e Binary files /dev/null and b/TotalEarnings.class differ diff --git a/src/7Inter.png b/src/7Inter.png new file mode 100644 index 0000000..86a45c6 Binary files /dev/null and b/src/7Inter.png differ