my program doesn't work correctly because this exception

                for (int i = 0; (i < ourThreads.length)
                        && count < sharedBetweenThreads.size(); i++) {
                    if (ourThreads[i].isAlive() == false) {


if the length of an array of threads(ourthreads) equal 2.
the two threads start and then the program check the while condition and if it's true
he check if ourThreads.isAlive() == false and then the thread must start
but unfouretantly ,it's throw this exception

please how can I solve this problem

Because the thread was probably already started and is simply finished now. Once that happens you cannot restart it, you must create a new one.