Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why start() method  RSS feed

 
Akhil Nagpal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
why we call the start() method of the class extending the Thread class instead of run() method.
Akhil
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling the start() method will cause the run() method to be called.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
start() sets up threading and makes the run() method run in a separate thread. If you just call run(), it will run in the current thread.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!