So what I'm trying to do is the following:
Each time I call a method to "create a new Thread", a new Thread with parsed object is added to a List of type <Thread> (see code below).
public class NewThreads {
static ArrayList<Thread> threadList = new ArrayList<>():
static int i = 0;
public static void newThread(String name){
threadList.add(new Thread(new myObject(name)));
threadList.get(inst).start();
inst ++;
}
}```
The myObject class implements Runnable.
In another class, I access the threads objects name variable as follows ("0" should simply access the first index of the list for testing):
```java
. . .
System.out.print(NewThreads.threadList.get(0).getName();
. . .```
However, I can't call "getName()" on the thread (getName is a method of the myObject class). I don't know how to acces the object in the thread once it's in the list. I would appreciate any help.