File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ public static void main(String []args)throws InterruptedException
1818
1919 Thread ct =new Thread (c );
2020
21- pt .start ();
21+ pt .start (); // Thread execution begins
2222
2323 ct .start ();
2424
25- pt .join ();
25+ pt .join (); // Current thread execution is paused, until specified thread is dead.
2626
2727 ct .join ();
2828
@@ -84,7 +84,7 @@ synchronized void get()
8484 if (!valueset )
8585 {
8686 try {
87- wait ();
87+ wait (); // Current thread will wait until notify() is invoked
8888
8989 } catch (InterruptedException e ) {
9090
@@ -95,7 +95,7 @@ synchronized void get()
9595
9696 System .out .println ("Got" +" " +this .n );
9797
98- notify ();
98+ notify (); // Wakes up thread that is waiting on Object's monitor
9999 }
100100 synchronized void set (int n )
101101 {
@@ -116,4 +116,4 @@ synchronized void set(int n)
116116
117117 notify ();
118118 }
119- }
119+ }
You can’t perform that action at this time.
0 commit comments