What is more advisable to create a thread, by implementing
a Runnable interface or by extending Thread class?
Answer Posted / devarathnam c,kotagudibanda(po
Hi...To create a Thread ,implement the Runnable interface
it is more advisable than extending a Thread class.By
extending the Thread class u can't achieve the multiple
inheritance.So implementing the Runnable interface is good
programming practice.
public class ThreadTest extends Thread,Applet
//This is illegal
public class ThreadTest extends Applet implements Runnable
//This is legal.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What language is java written?
Is null a keyword in java?
What is OOP Language?
What is difference between c++ and java ?
Define canvas?
How do you use equal in java?
What is the difference between inheritance and encapsulation?
Which variable is the independent variable?
Difference between static binding and dynamic binding?
What is the significance of listiterator?
What are the new features in java 8?
Which methods cannot be overridden in java?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
What is the difference between the direct buffer and non-direct buffer in java?
Is there a way to increase the size of an array after its declaration?