Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of implementing Runnable Interface

 
aresh babu
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

can any one please let me know the use of implementing Runnable interace than extending a Thread class except achieveing the multiple inheritance??


Thanks
AreshBabu
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think if you extend 'Thread', you cannot extend any other class.
But if you implement 'Runnable' you still can extend some class and implements other interfaces if you want to.

Other than that I don't know any differences.

note that "Thread" class also implements "Runnable" interface
that is why we can call

 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally implementing Runnable is more common than extending Thread class. Extending the Thread class doesn't give you much that you can use...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic