why Runnable interface is preferable than extending the
Thread class?

Answer Posted / praveen gupta

The main reason to implement Runnable interface is that you know that java does not supporting multiple inheritance
through classes .if u extend Thread class,u can't extend any
class which you required other than thread class.if u are
implementing runnable interface u can extend any class which
you required other than thread class.this is main advantage of
implementing java.lang.Runnable interface.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is constructor chaining in java?

583


Can classes declared using the abstract keyword cab be instantiated?

557


What is the benefit of inner / nested classes ?

525


Write a code to show a static variable?

613


What is Major and importance difference between for and foreach loop ?

570






List the three steps for creating an object for a class?

515


Explain importance of inheritance in java?

604


What is the length of a string?

518


What is the set interface in java programming?

623


How to change the priority of thread or how to set the priority of thread?

611


Can you extend main method in java?

616


How to compare two strings in java program?

669


What are design patterns and please explain?

568


which pattern is default in scanner package?

1799


Differentiate between overriding and overloading cases?

595