Question: 1. Write a java program using Thread to do the following: The main program initializes an array of size 1000 with random number between 1-10
1. Write a java program using Thread to do the following:
The main program initializes an array of size 1000 with random number between 1-10
It creates 5 threads and tell each thread to find the sum of the 200 elements and return the result
The main adds the 5 results and print the sum
2. Write a java program using Thread to do the following:
The main program initializes an array of size 1000 with values from 1-1000
Shuffle the array
Ask user to enter a number between 1 to 1000
Create 5 threads and pass the number and section of the array with 200 elements.
Each thread check to see if the number you typed is in that section of the array. If yes returns the index of the array, if not returns -1
The main print the name of the Thread
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
