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 is the function of java?
Which is easier .net or java?
What is the difference between heap and stack memory?
Variables used in a switch statement can be used with which datatypes?
What are the two categories of data types in the java programming language?
When should I use singleton pattern?
Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.
What is multiple inheritance? Is it supported by java?
What is close method? How it's different from Finalize & Dispose?
How do you execute a thread in java?
What is boolean false?
Define inheritance with reference to java.
Can we increase size of array?
How is it possible for two string objects with identical values not to be equal under the == operator?
Can we override the static methods?