posted 11 years ago
Problem in hand is - you want to transfer information from one thread to another thread
If you want to transfer each number [ array element] of array individually then you can trying using Blocking Queue where your one thread places the array element on blocking queue .. then .. another thread takes that number from blocking queue and perform the summation. Hint - try to apply Producer Consumer thread pattern here [ using wait/notify or blocking queue] . Producer is the thread read number from console. Consumer thread is the thread doing summation.
If you want to transfer whole array at one go from one thread to another thread, probably you do not require any threads. Steps can be done sequentially.