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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started