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   To Refer this Site to Your Friends   Click Here
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
how many ways to create Thread and which one is good?
runnable interface ot Thread class?
 Question Submitted By :: Chandranallam
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how many ways to create Thread and which one is good? runnable interface ot Thread class?
Answer
# 1
Two ways to create threads
1)by creating thread class
 class classname extends Thread
{


}
2)By converting class to thread ie using Runnable interface
 
Is This Answer Correct ?    4 Yes 1 No
Guest
 
  Re: how many ways to create Thread and which one is good? runnable interface ot Thread class?
Answer
# 2
types of creating thread
1)extend thread class
2)implement by runnable interface
=>2"nd method is good because by using interface we can
implement multiple inheritance
 
Is This Answer Correct ?    2 Yes 0 No
Balaji@cse@crr Engg@eluru
 
 
 
  Re: how many ways to create Thread and which one is good? runnable interface ot Thread class?
Answer
# 3
Two ways of creating Thread
1)By extending java.lang.Thread class
2)By implementing java.lang.Runnable interface
  Here 2"nd way is good because  by using interface we can
implement multiple inheritance in our class
 
Is This Answer Correct ?    1 Yes 0 No
Srinu
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Write a program to create a binary Tree ?  1
what is the use of abstract class and interface with example? DNS2
how to connect one jsp page to another jsp page???? Symphony4
What is difference between static method and static variable?  6
Can an unreachable object become reachable again?  3
What are Encapsulation, Polymorphism and Inheritance?  2
What are the Object and Class that classes used for?  3
define System.out.println(); what is the meaning!  8
What is deadlock and how to avoid this?  2
Can Applet have constructors?  3
what is web.xml?and its use? CTS6
What JNDI(Java Naming and Directory Interface) provides?  4
What is meant by controls and types?  1
public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod TCS3
why java not supproting multiple inheritance?  5
which methods consisting of the serilizable interface?  3
What is the difference between a public and a non-public class?  2
How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ? Saksoft1
How the threads are synchronized? BMC2
what is an object and how do you allocate memory to it? Wipro3
 
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