We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to to execute a thread withing a subclass, something like this:
void setup(){
testClass test = new testClass();
test.go();
}
class testClass{
void go(){
thread("thing");
}
void thing(){
for(int i = 0;i<30;i++){
print(i);
}
}
}
but I get the error: There is no public thing() method in the class sketch_160201a
The actual thing I want to do this with involves an array of subclass instances, each one with different values that the thread uses. Any good ways to do this, other than:
void setup(){
testClass test = new testClass();
test.go();
}
void toThread(testClass use){
use.thing();
}
class testClass{
void go(){
thread("toThread");
}
void thing(){
for(int i = 0;i<30;i++){
print(i);
}
}
}
But that doesn't work because the thread() command can't pass arguments. I think there may be a way to do this with the java Thread class, but I couldn't find a good way to do this.
Answers
That makes sense, but can someone tell me how to use the Thread class from java to do this?