ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
why Runnable interface is preferable than extending the
Thread class?
 Question Submitted By :: Shivakrishna
I also faced this Question!!     Rank Answer Posted By  
 
  Re: why Runnable interface is preferable than extending the Thread class?
Answer
# 1
u know that java not supporting multiple inheritance.if u
extend thread class,u can't extend any class which you
required other than thread class.if u are implementing
runnable interface u can extend any class which you required
other than thread class.this is main advantage of
implementing runnable interface.
 
Is This Answer Correct ?    34 Yes 7 No
Suresh
 
  Re: why Runnable interface is preferable than extending the Thread class?
Answer
# 2
Many Java programmers feel that classes should be extended 
only when they are enhanced or modified in some way.So,if 
you will not be overriding any of Thread's other methods,it 
is probably best simply to implement Runnable.
 
Is This Answer Correct ?    12 Yes 1 No
Susheeel
 
 
 
  Re: why Runnable interface is preferable than extending the Thread class?
Answer
# 3
imolimen Runnabule inerface and extends Thread functionally 
both are same.But implimenting RunnebleInterface more 
advantage because of there is possibility extends more then 
one class and also we can override run() only once.
 
Is This Answer Correct ?    4 Yes 1 No
Rameshkrishna
 
  Re: why Runnable interface is preferable than extending the Thread class?
Answer
# 4
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 ?    0 Yes 1 No
Myluvdeepu
 
  Re: why Runnable interface is preferable than extending the Thread class?
Answer
# 5
you know that java  does not supporting multiple inheritance
through classes .if u extend Thread class,u can't extend any
class which you required other than thread class.if u are
implementing runnable interface u can extend any class which
you required other than thread class.this is main advantage of
implementing java.lang.Runnable interface.
 
Is This Answer Correct ?    0 Yes 2 No
Srinu
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Which all r Final classes in java except string?  3
what is Remote Reference Layer ?  1
What are interfaces?  1
why to use transient variables when static variables can be used for Serialization  3
byte a=5; byte b=5; byte c=a+b; System.out.println(c); whats the o/p? Wipro5
How to prevent a field from serialization ?  2
Explain in detail about encapsulation with an example?  3
what is difference between throw and throws in exception?  16
What is an array and a vector? How they different from each other?  3
"We cannot create an object of interface but we can create a variable of it". Discuss the statement with the help of an example. (Plz help us to provide immediately.)  1
Can a for statement loop indefinitely?  3
How GC (Garbage Collector) knows the objects reference is unused.Whether GC removes the unused object Parmanently or it maintains something.  2
What are command line arguments?  2
What is the is a and has a relation ship in oops concept in java? BearingPoint5
What is the immediate superclass of the Dialog class?  1
How to declare unique ArrayList ? RMSI4
Why const and goto are reserved keyword in java?  1
what is the difference b/w design pattern and architecture Covansys2
why applet doesn't have main? isn't possible a program with out main?  5
Difference between overloading and Overriding. <Giving a confusing example to test the concept.> (also asked in PA Consultancy Group,iflex,Value chain,IBM,CTS,Accenture, Tarang> Symphony6
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com