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
Which variables are stored in stack?
What is the locale class in java programming?
What do you understand by soft reference?
Is hashset ordered java?
What do you mean by ordered and sorted in collections in java?
What is meant by polymorphism?
Explain wrapper classes in java?
Why do we need singleton?
What is the purpose of javac exe?
What is the private method modifier?
Which are the two subclasses under exception class?
Write a program in java to establish a connection between client and server?
What is the string function?
How does sublist works in java?
I want to print “hello” even before main is executed. How will you acheive that?