How can I add input arguments to run method in java threading?
@Override
public void run(int a, String b){
// do something
}
// The method run(int) of type particle_explode must override or implement a supertype methodJava(67109498)
If I add argument, it said The method run(int) of type particle_explode must override or implement a supertype methodJava(67109498)
So how can I add argument to it?
>Solution :
Put the values to the Runnable and have the Thread run that.
Runnable r = new MyRunnable(a, b);
new Thread(r).run();
If you need a convenient way to run a variety stuff in the background, submit() runnable things to an Executor.