How an array of Threads works...
Greetings. I'm looking for some information regarding how Threads and arrays can work together. I've created a Thread class that extends Threads. I have an array of this class and as an event happens I trigger this thread to start. Once the Thread is finished, I attempt to remove its position in the array such:
Please note that the code above is just a short remaking of what i'm trying to do and is not the exact code I have setup, but that is the general idea.
classThreadExample example = new classThreadExample
// Now say I want to remove Thread b
// Now I want to use example space as a new event happens...
example = new classThreadExample(passInSomeStuff);
example.start(); //Produces illegal Thread State
Now I know that once a Thread has been started, it cannot be started again, even when it has finished. What I am not sure of is why this thread finishes but does not disappear from the array. I've even tried setting the array spot to null and it will not produce any different results.
If you know of a proper way to deal with this kind of situation, any insight would be useful. Thanks.