File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Use of implementing Runnable Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Use of implementing Runnable Interface" Watch "Use of implementing Runnable Interface" New topic

Use of implementing Runnable Interface

aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65

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

Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

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

SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Generally implementing Runnable is more common than extending Thread class. Extending the Thread class doesn't give you much that you can use...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: Use of implementing Runnable Interface
It's not a secret anymore!