Currently iam learning Threads topic from Kathy Sierra.
I am trying to write a typical producer-consumer code that makes use of the join() method of Thread.
This is what i want to accomplish :
1> There will be 3 threads Thread_A, Thread_B and Thread_C.
2> Thread_A's job is to continuously take input from the User from console and store it in an ArrayList.
The input will be in form of positive integer numbers ( eg: 2, 3, 100, 50 ....).
3> Thraed_B's job is to iterate through the array list and read these values one-by-one and store it in a variable.
Thraed_B will not read the next values unless Thread_C has finished its job.( Thread_B has join() on Thread_C)
4> Thread_C's job is to print '#' character in a File as per the values in the variable. So if the
values is say 20, then Thread_C will print '#' 20 times in the file.
To summarize, if the user has entered (20, 5, 10, 50) then Thread_C should print '#' 20 times, then 5 times then 10 times.....
I am not getting where to start the Thread_C.