How can I create a for loop which creates multiple threads which can be identifiable. The threads are Players in a game and need to communicate with each other. I need to be able to access each player's getters and setters.
Basically, each Player has a name attribute and needs to be identifiable. If i do this, I don't see how they are identifiable from one another...
for (int i = 0; i < numberOfPlayers; i++)
{
Thread t = new Thread(new Player("Player" + (i + 1), (i + 1), (i + 2)));
}
t.start();and this tutorial would help you, or these examples