I am experimenting with the multithreading in java and I have a nullPointerException. I try to pass a parameter in my thread and i missed up somewhere but i dunno where. I hope someone can point me where i was stupid :). I wrote this class :
public class MyThread extends Thread{
private String myBelovedParam = null;
public MyThread (String param){
myBelovedParam = param;
}
public void run(){
try {
AnotherClass.anotherFunction(myBelovedParam );
} catch (InterruptedException e) {
e.printStackTrace();
}
}}
And I called it like that :
Thread myThread = new MyThread (theParameterIWant);
myThread.start();
Thanks all and have a good day !
I edit my post (i change the name of everything and i forgot to change some. that why the name of some thread was different).
Here is the error i get in my console :
Exception in thread "Thread-7" java.lang.NullPointerException
at play.classloading.enhancers.ControllersEnhancer$ControllerInstrumentation.isActionCallAllowed(ControllersEnhancer.java:187)
at anotherFunction(AnotherClass.java)
at threads.myThread.run(myThread.java:21)
I tried to change null by empty String -> no Effect When i debug i can see clearly that theParameterIWant is not null.