Why do we call the thread object\'s start() method which in turns calls run() method, why not we directly call run() method?
It's due to the design of multithreading in Java.
Calling start () will start a new Thread and calling run() method does not start a new Thread.
If you call start() method on Thread, Java Virtual Machine will call run() method and two threads will run concurrently now - Current Thread and Other Thread or Runnable implementation.
Have a look at source code of start() method in Thread class
/**
* Causes this thread to begin execution; the Java Virtual Machine
* calls the run method of this thread.
*
* The result is that two threads are running concurrently: the
* current thread (which returns from the call to the
* start method) and the other thread (which executes its
* run method).
*
* It is never legal to start a thread more than once.
* In particular, a thread may not be restarted once it has completed
* execution.
*
* @exception IllegalThreadStateException if the thread was already
* started.
* @see #run()
* @see #stop()
*/
public synchronized void start() {
/**
* This method is not invoked for the main method thread or "system"
* group threads created/set up by the VM. Any new functionality added
* to this method in the future may have to also be added to the VM.
*
* A zero status value corresponds to state "NEW".
*/
if (threadStatus != 0)
throw new IllegalThreadStateException();
group.add(this);
start0();
if (stopBeforeStart) {
stop0(throwableFromStop);
}
}
private native void start0();
In above code, you can't see invocation to run() method.
private native void start0() is responsible for calling run() method. JVM creates native thread corresponding to java thread and call run() method.
Refer to this question for source code of native methods:
Where to find source code for java.lang native methods?