We have two methods to create methods the threads.
1. Implementing runnable interface
2. Extending to thread class and overriding run method.
Among these two which one is better and why?
Please explain me in detail.

Answer Posted / venkat

implementing runnable interface is better than extending to
thread why because if u implements from runnable interface u
can have chance to extend one more class.but incase of
extending thread this facility is not there

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which package has light weight components?

790


What is the synchronized method modifier?

894


What is substring 1 in java?

822


Is class is a data type?

836


How does multithreading take place on a computer with a single cpu?

806


What is runtime locatable code?

1156


List the different types of classloaders in java.

751


Can we sort list in java?

809


How do you sort a set in java?

741


What is vector?

798


What are bind parameters?

791


explain local datetime api in java8?

808


How do you access command-line arguments within the code?

830


What is the use of java?

761


How to print nodes of a Binary tree?

2038