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
How do you create a method in java?
What is a nullable field?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
What is singleton service?
What is the difference between length and length() method in java?
Why do we override tostring method in java?
is there a separate stack for each thread in java? : Java thread
Can we have any code between try and catch blocks?
What are triggers in DB? Explain their types. How do they work?
What is the difference between abstract class and interface1? What is an interface?
How do you remove an element from an arraylist in java?
What are the fileinputstream and fileoutputstream?
How do you escape in java?
What does java edition mean?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.