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


Please Help Members By Posting Answers For Below Questions

What is regex java?

556


What are the three types of design patterns?

507


How many functional interfaces does java 8 have?

603


What is the importance of main method in Java?

572


What are the differences between Java 1.0 and Java 2.0?

1675






What is a prefix function.write down a code to compute prefix function.

534


what is inner class in java?

622


What is an array in java?

636


How objects of a class are created if no constructor is defined in the class?

576


Why runnable interface is used in java?

564


What is array length?

501


What do you mean by pointer value and address?

575


What does those terms actually mean included in the j.d.k i.6?

1599


Is java call by value?

583


Which package is used for pattern matching with regular expressions?

642