How many ways to create Thread and which is better?

There are two ways to create Thread:
  • By extending java.lang.Thread class and
  • By implementing java.lang.Runnable interface
Which one is better?
We can't say which one is better but only difference is that:
  • When you extends Thread class you can't extends some other classes but
  • When you implement Runnable interface you can implement some other java class also

4 comments :

  1. Thanks..please go through this blog also explained good http://adnjavainterview.blogspot.in/2014/06/how-many-ways-to-create-thread-in-java.html

    ReplyDelete
  2. This is good ideas that gives good learning in doing some programs with the use of some JavaScript. A very simple way to create a thread is what you have show in your blog, and it was nice to hear about this.

    ReplyDelete
  3. Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
    White Label Website Builder

    ReplyDelete
  4. Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.morephp jobs in hyderabad.
     

    ReplyDelete