I have a question about the run method in Java, i know that when we call start()
method a "stack" is created in JVM memory and that is the place where the run()
method start its execution, but which object is used to call this method in the code below, the thread object(t1)
or the runnable object(obj)
that I have passed in?
I have trouble understanding this.
public class A implements Runnable {
public void run() {
System.out.println("....");
}
public static void main(String[] args) {
A obj = new A();
Thread t1 = new Thread(obj);
t1.start();
}
}