I have two threads, one for an int array input and other for calculating the sum of the elements in the array. I am able to create the first thread which takes an int array but not the second one. Please help
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.