why Runnable interface is preferable than extending the
Thread class?
Answer Posted / myluvdeepu
if we extend thread then we can't extend other class.
but if we implement runnable interface we can implement as much interface as we can, there is no restriction.
thread call the run method automatically(if called with no-arg).but for runnable we need to call run method.
thread cause problem in multiple inheritance.
but runnable interface don't.
| Is This Answer Correct ? | 4 Yes | 9 No |
Post New Answer View All Answers
If an object reference is set to null, will the garbage collector immediately free the memory held by that object?
What is the history of java?
What is parse method?
Define canvas?
When should I use a singleton?
What is a method in programming?
What do you know about java?
Can we override the static methods?
What is the file extension for java?
Why lambda expression is used in java?
Can the interface be final?
How can you add and remove nodes in jtree?
What is the concept of multithreading?
What are the advantages of defining packages in java?
What are access specifiers available in java?