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

Can a top level class be private or protected?

788


Can we call the run() method instead of start()?

793


Write a program to show whether a graph is a tree or not using adjacency matrix.

842


What is the use of put method?

729


What is the purpose of the runtime class in java programming?

790


Why string is not thread safe?

768


What is a wrapper method?

761


What is callable java?

742


What is number data type?

770


What is the difference between stringbuffer and stringbuilder?

763


What are the two types of java programming?

754


What is equals method in java?

743


Garbage collection in java?

781


Write a program to find maximum and minimum number in array?

759


What is mnemonic code?

768