Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers
Antivirus Faqs_Questions_And_Answers Software Tips Faqs_Questions_And_Answers ERP Faqs_Questions_And_Answers Internet Faqs_Questions_And_Answers Spoken English Faqs_Questions_And_Answers Web Designing Faqs_Questions_And_Answers SEO Tips Faqs_Questions_And_Answers Hacking
Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers
SAP Faqs
C Faqs        C++ Faqs        Java Faqs        J2ee Faqs        Springs Faqs        Hibernate Faqs        Web sphere Faqs        Web Logic Server Faqs   
WordPress        Siebel Faqs        Shell Scripting Faqs        Perl Scripting Faqs        Open Source        Data Ware Housing Faqs        Joomla Faqs
Ajax        Oracle Apps Faqs        Testing Tools Faqs        Mainframes Faqs        Tibco Faqs        PHP Faqs        .Net Faqs       Operating System
 
Custom Search
RMI Interview Questions
EJB Interview Questions
JSP Interview Questions
JMS Interview Questions
JDBC Interview Questions
OOPS Interview Questions
Servlet Interview Questions
Applets Interview Questions
Awt Swing Interview Questions
Java Threads Interview Questions
Architectures of Java Faqs
Java Lang Package Faqs
Architectures of Java Faqs
Java Garbage Collection Faqs
Java Exception Handling Faqs
Core Java and Advanced Java
 
Java Threads Interview Questions And Answers
1 what are the two types of multitasking?
Ans: a. Process-based.
b. Thread-based.
2 what is a Thread?
Ans: A thread is a single sequential flow of control within a program.
3 what are the two ways to create a new thread?
Ans: A.Extend the Thread class and override the run () method.
B.Implement the Runnable interface and implement the run () method.
4 If you have ABC class that must subclass XYZ class, which option will you use to create a thread?
Ans: I will make ABC implement the Runnable interface to create a new thread, because ABC class will not be able to extend both XYZ class and Thread class.
5 which package contains Thread class and Runnable Interface?
Ans: java. Lang package
6 what is the signature of the run () mehod in the Thread class?
Ans: public void run ()
7 shich methods calls the run () method?
Ans: start () method.
8 which interface does the Thread class implement?
Ans: Runnable interface
9 what are the states of a Thread?
Ans: Ready, Running, Waiting and Dead.
10 where does the support for threading lie?
Ans: The thread support lies in java.lang.Thread, java.lang.Object and JVM.
11 In which class would you find the methods sleep () and yield ()?
Ans: Thread class
12 In which class would you find the methods notify (), notify All () and wait ()?
Ans: Object class
13 what will notify () method do?
Ans: notify() method moves a thread out of the waiting pool to ready state, but there is no guaranty which thread will be moved out of the pool.
14 Can you notify a particular thread?
Ans: No.
15 what is the difference between sleep () and yield ()?
Ans: When a Thread calls the sleep () method, it will return to its waiting state. When a Thread calls the yield () method, it returns to the ready state.
16 what is a Daemon Thread?
Ans: Daemon is a low priority thread which runs in the backgrouund.
17 How to make a normal thread as daemon thread?
Ans: We should call set Daemon (true) method on the thread object to make a thread as daemon thread.
18 what is the difference between normal thread and daemon thread?
Ans: Normal threads do mainstream activity, whereas daemon threads are used low priority work. Hence daemon threads are also stopped when there are no normal threads.
19 Give one good example of a daemon thread?
Ans: Garbage Collector is a low priority daemon thread.
20 what does the start () method of Thread do?
Ans: The thread's start () method puts the thread in ready state and makes the thread eligible to run. Start () method automatically calls the run () method.
Page :    1 | 2
Top

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player