Please share your understanding about the start and run method in a Thread Thread t t.start()or t.run() Its basic that we can call direct run() method of the runnable interface and call start method of the Thread class. But I want to know wether there is specific rule for them or they are same.
Dream!!! Set Vision !! Transform Vision to Mission by Actions on Deadlines!.
the start() method , creates a new call stack and put this thread in new state. But the run() methods has the job or the stuffs needs to be executed in a seperate thread. This method doesnt create a new thread. When a thread goes to running state then it executes the statements in the run method.
Yes, basically calling start() method will create a separate new thread in your program then this new thread will run the codes specified by run().
Calling run() will of course also causes the codes in run() to be run but in the current thread(for example, the main program). No new thread will be created.