• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread starting sequence  RSS feed

 
bhaswar goswami
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See guys ..
i have one query .
when we start a thread by calling start() method . that method intern
calls run() method . though this run method is public one then why can't we
call this method directly instead of calling the start() method first ?
can u plz, reply this question.
 
Henry Wong
author
Sheriff
Posts: 23284
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The start() method does more than call the run() method -- and technically, it doesn't really directly call the run() method.

It creates/starts a new thread, using the paramaters set in the thread object, and it is then new thread that eventually calls the run() method.

If you want, you can call the run() method, but it will be no different than calling any other method.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!