Java - Interview Questions and Answers for 'Threads' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Universal Java Thread Dump Analyzer



Link: http://fastthread.io/
   




Interview Questions and Answers for 'Threads' - 51 question(s) found - Order By Newest

 Q1. Which keyword is used to provide explicit access of a code block to single thread ?

a. Transient
b. Final
c. Explicit
d. Synchronized
Core Java
Anonymous
Ans. Synchronized

  Sample Code for Synchronized

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading     Infoview  HCL Technologies      basic


Frequently asked to fresh graduates and less experienced developers.
 Q2. Explain multithreading in Java ?Core Java
Anonymous
Ans. 1. Multithreading provides better interaction with the user by distribution of task

2. Threads in Java appear to run concurrently, so it provides simulation for simultaneous activities.The processor runs each thread for a short time and switches among the threads to simulate sim-ultaneous execution (context-switching) and it make appears that each thread has its own processor.By using this feature, users can make it appear as if multiple tasks are occurring simultaneously when, in fact, each is running for only a brief time before the context is switched to the next thread.

3. We can do other things while waiting for slow I/O operations.In the java.iopackage, the class InputStreamhas a method, read(), that blocks until a byte is read from the stream or until an IOExceptionis thrown. The thread that executes this method cannot do anything elsewhile awaiting the arrival of another byte on the stream.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading  concurrency   multithreading     Hamsini ECommerce   Cognizant (CTS)  Cumulus Systems  Cognizant (CTS)      intermediate        frequent

Try 1 Question(s) Test


 Q3. Can constructors be synchronized in Java ?Core Java
Anonymous
Ans. No. Java doesn't allow multi thread access to object constructors so synchronization is not even needed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     synchronization   synchronize   constructor   java   multithreading   yes-no   advanced     Tieto      expert        rare


Usually asked only to fresh graduates.
 Q4. What is the difference between time slicing and preemptive scheduling ?Operating System
Anonymous
Ans. In preemptive scheduling, highest priority task continues execution till it enters a not running state or a higher priority task comes into existence. In time slicing, the task continues its execution for a predefined period of time and reenters the pool of ready tasks.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     operating system   scheduling   threads   multi threading        rare


 Q5. Different ways of implementing Threads in Java ?Core Java
Anonymous
Ans. Threads in Java can be implement either by Extending Thread class or implementing runnable interface.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading     Cognizant (CTS)      basic        frequent


Frequently asked to fresh graduates.
  Q6. Difference between Process and Thread ?Operating System
Anonymous
Ans. Process is a program in execution whereas thread is a separate path of execution in a program.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   operating system   basic interview question     Walt Disney  Goldman Sachs  Nuance  Bank of America  Cogent Infotech  Sogeti  Siemens  Veritas  Vudu  One97 Communications  Riverbed Technology  TK20  MZ  Utopia  LogicMonitor  Lockheed Martin  Lab49  IGATE  Intel Corp  Verint Systems  Kronos  Amazon.com  Citrix  Persistent Systems      basic        frequent


Frequently asked to fresh graduates.
  Q7. What is a Deadlock ?Operating System
Anonymous
Ans. When two threads are waiting each other and cant precede the program is said to be deadlock.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   operating system   deadlock  concurrency     Lime Wire  Perfect Sense  QuantCast  Aequitas NEO Exchange  Akuna Capital  Juniper Networks  Casale Media  Netflix  NetApp  Apple  AIG  Cpart  SnapStream Media  Cumulus Systems  Wissen Infotech  HedgeServ Corp  KeyIdeas Infotech  Verint Systems  BlackBerry  EverQuote      basic        frequent


Frequently asked to fresh graduates.
 Q8. Explain Thread States ?Operating System
Admin
info@buggybread.com
Ans. Runnable - waiting for its turn to be picked for execution by the thread schedular based on thread priorities.

Running - The processor is actively executing the thread code. It runs until it becomes blocked, or voluntarily gives up its turn.

Waiting: A thread is in a blocked state while it waits for some external processing such as file I/O to finish.

Sleeping - Java threads are forcibly put to sleep (suspended) with Thread.sleep. they can resume using Thread.resume method.

Blocked on I/O - Will move to runnable after I/O condition like reading bytes of data etc changes.

Blocked on synchronization - Will move to Runnable when a lock is acquired.

Dead - The thread is finished working.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   scheduling   thread states   basic interview question     Cognizant (CTS)      basic        frequent

Try 2 Question(s) Test


 Q9. What is race condition ?Operating System
Admin
info@buggybread.com
Ans. A source of possible errors in parallel programming, where one thread can cause an error in another thread by changing some aspect of the state of the program that the second thread is depending on (such as the value of variable).

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java.threads   multithreading   race condition   parallel programming   synchronization   ebay   concurrency     ISB Vietnam  NetSpend  Polycom  Cerner  NVIDIA  US Bank  Amadeus  McKesson  Hulu  Neelkanth Digital



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. What is the use of runnable interface if we can always create a new thread using Thread class ?Core Java
Admin
info@buggybread.com
Ans. It's a choice to be made whether to use first approach ( Thread class ) or second approach ( runnable interface ) by the programmer. The second facility has been given for cases where your class is already extending some parent class and hence cannot extend another class ( for Thread ) as Java doesn't allow multiple inheritance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading   runnable interface  concurrency


 Q11. Why do we need Thread class even in case we execute thread using runnable interface ?Core Java
Admin
info@buggybread.com
Ans. Thread class holds the definition of start method ( This is the method that starts execution of new thread and then calls run method within the scope of new thread ). Interfaces don't hold any definition and so does runnable. So it makes it necessary the usage of Thread class , whatever implementation you choose.

When your class extends the thread class, it carries the definition of start method from parent Thread class onto itself and hence new yourClass.start() helps starting a new thread and then executing run method in that new thread scope.

When you implement runnable interface , you are just making it sure to the JVM that you have implemented the required method ( run() ) which the Thread start method will look for upon executing start method.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading   runnable interface   thread class


Frequently asked to fresh graduates.
 Q12. What are the difference between Threads and Processes ?Operating System
Anonymous
Ans. 1. when an OS wants to start running program it creates new process means a process is a program that is currently executing and every process has at least one thread running within it.
2). A thread is a path of code execution in the program, which has its own local variables, program counter(pointer to current execution being executed) and lifetime.
3. When the JavaVirtual Machine (JavaVM, or just VM) is started by the operating system, a new process is created. Within that process, many threads can be created.
4. Consider an example : when you open Microsoft word in your OS and you check your task manger then you can see this running program as a process. now when you write something in opened word document, then it performs more than one work at same time like it checks for the correct spelling, it formats the word you enter , so within that process ( word) , due to different path execution(thread) all different works are done at same time.
5. Within a process , every thread has independent path of execution but there may be situation where two threads can interfere with each other then concurrency and deadlock come is picture.
6. like two process can communicate ( ex:u open an word document and file explorer and on word document you drag and drop another another file from file explorer), same way two threads can also communicate with each other and communication with two threads is relatively low.
7. Every thread in java is created and controlled by unique object of java.lang.Thread class.
8. prior to jdk 1.5, there were lack in support of asynchronous programming in java, so in that case it was considered that thread makes the runtime environment asynchronous and allow different task to perform concurrently.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   operating system   threads   processes     Ciena  Walt Disney        frequent


Usually asked only to fresh graduates.
 Q13. Why threads block or enters to waiting state on I/O?Operating System
Anonymous
Ans. Threads enters to waiting state or block on I/O because other threads can execute while the I/O operations are performed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading   scheduling   operating system


Frequently asked to fresh graduates.
 Q14. What is the difference between yield() and sleep()?Operating System
Anonymous
Ans. When a object invokes yield() it returns to ready state. But when an object invokes sleep() method enters to not ready state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   yield   sleep   scheduling   operating system     RedMane  Levi9  RedMane Technology  Time      basic        frequent


Usually asked only to fresh graduates.
 Q15. What is the initial state of a thread when it is created and started?
Anonymous
Ans. Ready state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     operating system   threads   multi threading   java   thread states     Cognizant (CTS)      basic        frequent


 Q16. Can a lock be acquired on a class ?
Anonymous
Ans. Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   scheduling   threads   multi threading      expert        rare


 Q17. What state does a thread enter when it terminates its processing?
Anonymous
Ans. When a thread terminates its processing, it enters the dead state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   scheduling   thread states


 Q18. What is an object's lock and which object's have locks?
Anonymous
Ans. An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   scheduling   synchronizing


 Q19. What is suspend() method used for ?
Admin
info@buggybread.com
Ans. suspend() method is used to suspend the execution of a thread for a period of time. We can then restart the thread by using resume() method.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   operating system   synchronization      basic        rare



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



Usually asked only to fresh graduates.
 Q20. Difference between suspend() and stop() ?
admin
info@buggybread.com
Ans. Suspend method is used to suspend thread which can be restarted by using resume() method. stop() is used to stop the thread, it cannot be restarted again.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   operating system   synchronization   suspend   stop      basic        rare


 Q21. Difference between yield() and sleeping()?
Admin
info@buggybread.com
Ans. When a task invokes yield(), it changes from running state to runnable state. When a task invokes sleep(), it changes from running state to waiting/sleeping state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   scheduling   thread states   yield   sleeping


Usually asked only to fresh graduates and less experienced developers.
  Q22. What is a daemon thread? Give an Example ?
Admin
info@buggybread.com
Ans. These are threads that normally run at a low priority and provide a basic service to a program or programs when activity on a machine is reduced. garbage collector thread is daemon thread.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   operating system   daemon thread   garbage collection     Finnet  ServiceNow  MarketAxess Holdings  JP Morgan  Utopia  Samsung  CGI Group  Auriel Technologies      intermediate        frequent

Try 2 Question(s) Test


 Q23. What is ThreadFactory ?Core Java
Admin
info@buggybread.com
Ans. ThreadFactory is an interface that is meant for creating threads instead of explicitly creating threads by calling new Thread(). Its an object that creates new threads on demand. Using thread factories removes hardwiring of calls to new Thread, enabling applications to use special thread subclasses, priorities, etc.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   thread factory   thread creation   advanced      expert


 Q24. When you will synchronize a piece of your code?
Admin
info@buggybread.com
Ans. When you expect your code will be accessed by different threads and these threads may change a particular data causing data corruption.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multi threading   synchronization   concurrency      basic        frequent


 Q25. Write a Program to add 1-100, 101-200, 201-300 in different threads and then sum the numbers ?Core Java2016-11-30 20:51:58

Ans. public class TotalUsingThreads extends Thread{
   
   private static List<TotalUsingThreads> collector = new ArrayList<TotalUsingThreads>();
   
   private int startFrom = 0;
   
   private Integer threadTotal = null;
   
   Test(int startFrom){
      this.startFrom = startFrom;
   }
   
   
   public static void main(String[] args) throws InterruptedException{
      int totalSum = 0;
      
      // Create all the threads and set the count starting point for all of them
      for(int count=0;count<10;count++){
         TotalUsingThreads newThread = new TotalUsingThreads(count*100);
         newThread.start();
         collector.add(newThread);
      }
      
      boolean allCollected = false;
      
      
      // Make sure that all thread totals are collected and all threads have completed their tasks
      while(!allCollected){
         for(int count=0;count<10;count++){
            if(collector.get(count).threadTotal == null){
               Thread.sleep(100);
               break;
            }
         }
         allCollected = true;
      }
      
      // sum totals of all threads
      for(int count=0;count<10;count++){
         totalSum += collector.get(count).threadTotal;
      }
      
      System.out.println(totalSum);
      
      
   }
   
   public void run(){
      threadTotal = 0;
      for(int count=startFrom;count<startFrom+100;count++){
       threadTotal += count;   
      }
   }
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     coding  code  threads  multithreading     AQUA Equities


 Q26. Name few classes that extend Thread class ?Core Java
Admin
info@buggybread.com
Ans. http://www.buggybread.com/2015/02/java-threads-classes-that-inherit.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading   thread class     Infoview


 Q27. Name few Threads related classes and interfaces ?
Admin
info@buggybread.com
Ans. http://www.buggybread.com/2015/01/java-threads-classes-and-interfaces.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading


 Q28. What is the initial state of a thread when it is created and started ?

a. Wait
b. Running
c. Ready
d. Sleep
Anonymous
Ans. Ready

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading   thread states


 Q29. What state does a thread enter when it terminates its processing?

a. Wait
b. Ready
c. Dead
d. Running
Anonymous
Ans. Dead

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   threads   multithreading   thread states



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q30. Invoking start twice on same thread leads to ..

a. ClassCastException
b. NullPointerException
c. InterruptedException
d. IllegalStateException
Anonymous
Ans. IllegalStateException

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   exception   threads


 Q31. Print natural numbers sequentially with two threads.Core Java

Ans. http://stackoverflow.com/questions/18799591/print-natural-sequence-with-help-of-2-threads1-is-printing-even-and-2nd-is-pri

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     print natural numbers with two threads   multithreading   multi threading   threads   code   coding   makemytrip.com


 Q32. What is the use of Synchronized block ?Core Java

Ans. The goal of a synchronised block is to achieve mutual exclusion i.e at one time, the segment of the code should be executed by single thread only and hence the lock needs to be retrieved before executing the segment and then released.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     synchronized block   synchronized   synchronization   multithreading   threads   mutual exclusion   concurrency     Capgemini  Cognam Technologies  hewlett packard (HP)  BlackRock      intermediate        frequent

Try 1 Question(s) Test


 Q33. Difference between Yielding and Sleeping ?

Ans. When a task invokes its yield method, it returns to the ready state. When a task invokes its sleep method, it returns to the waiting state.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     multithreading  threads  yielding  sleeping  thread states


 Q34. In case of a synchronized method, Does the method only gets locked or the whole object ?Core Java2016-10-18 14:22:40

Ans. Just the method gets locked.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     synchronization  multithreading     MagicBricks


 Q35. What are the disadvantages of multithreading ?Core Java2016-10-11 08:47:41

Ans. 1. Switching Overheads - Even though multi threading aims at improving performance by reducing the wait time and hence improving overall throughput, there is a cost of switching resources between threads and sometime this cost can surpass the benefits if there isnt much wait for IO or external communication.

2. Debugging is hard with multi threaded code.

3. Deadlock - Execution of multi threaded code many a times lead to deadlock due to shared resources.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     multithreading  threads     Cognizant (CTS)  Wipro  Deloitte  IBM


 Q36. Can there be a Thread without a Process ?Core Java2016-11-30 20:50:27

Ans. No.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Thread  Process     Goldman Sachs      Basic


Very frequently asked.
 Q37. What is the use of synchronized keyword ?Core Java2016-11-04 08:15:53

Ans. Synchronize is used to achieve mutual exclusion i.e at one time, the segment of the code, method that has been declared synchronized should be executed by single thread only and hence the lock needs to be retrieved before executing the segment and then released.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     threads  multithreading  synchronized     CapitalOne  Deloitte  JP Morgan  Morgan Stanley  JP Morgan      basic        frequent


 Q38. Can we start the same thread twice ?Core Java2016-11-29 14:24:56

Ans. No we cannot start the same thread twice. Each thread has a lifecycle.

But Yes, we can run the same code in parallel using different threads.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     thread  multithreading


 Q39. Who invokes a thread's run method ?Core Java2017-01-12 11:23:15

Ans. After a thread is started using a call to start method, JVM invokes the thread’s run method when the thread is initially executed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     threads  thread run method     HCL Technologies



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q40. How do threads share information ?Core Java2017-02-27 07:33:36

 This question was recently asked at 'Concurrent Technologies Corporation (CTC)'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     threads     Concurrent Technologies Corporation (CTC)


 Q41. Can you give real time examples of thread or where thread are actually used ?Core Java2017-05-29 08:35:42

 This question was recently asked at 'Persistent Systems'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     threads  multithreading     Persistent Systems


 Q42. Can we synchronize the run() method in Java?Core Java2017-07-23 20:08:58

 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     synchronization  multithreading  run method


 Q43. If you need to consume messages from the queue faster, which approach will you recommend - batching or concurrency ?Design2017-07-24 13:34:47

Ans. Each has it's own advantages

Batching requires less resources but may result in loosing whole batch in case of failure whereas concurrency even though is little more expensive in terms of resources but would result in minimal loss in case of failure.

In case messages are to be consumed in a particular order, batching them in that order and then consuming them makes better sense.

if incoming messages are not continuous , it makes more sense to do concurrency as we need not wait for all messages to form a batch and flush. Though time sensitivity can be added but that would add unnecessary complexity.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     concurrency vs batching   concurrency  multithreading  batch


 Q44. If a Map needs to be accessed simultaneously by multiple threads, which collection class should be used ? Core Java2017-08-17 11:01:07

Ans. ConcurrentHashMap

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     map  concurrenthashmap  multithreading


 Q45. Why do we use Thread Class as well as Runnable Interface for creating threads in Java ?Core Java2017-08-19 19:34:44

 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Threads  Thread class  runnable interface


 Q46. How can we ensure thread safety in static method ?Core Java2017-08-27 07:49:53

 This question was recently asked at 'Accenture'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     threads  synchronization  static methods     Accenture


 Q47. Write a Program to show Java thread usage by extending Thread class2017-08-03 12:13:20

Ans. public class MyClass {
   static class MyThreadClass extends Thread{

      @Override
      public void run() {
         System.out.println("Hello");
         try {
            Thread.sleep(1000);
            System.out.println("Hello Again");
         } catch (InterruptedException e) {
            e.printStackTrace();
         }
         
      }
      
   }
   
   public static void main(String[] args){
      MyThreadClass myThreadClass = new MyThreadClass();
      myThreadClass.start();
      
      MyThreadClass myThreadClass2 = new MyThreadClass();
      myThreadClass2.start();
   }
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Threads  Thread class


 Q48. Write a program to show thread usage in Java by implementing runnable interface2017-08-03 12:16:07

Ans. public class MyClass {
   static class MyThreadClass implements Runnable{

      public void start() {
         Thread t = new Thread(this,"threadName");
         t.start();
      }
      
      @Override
      public void run() {
         System.out.println("Hello");
         try {
            Thread.sleep(1000);
            System.out.println("Hello Again");
         } catch (InterruptedException e) {
            e.printStackTrace();
         }
         
      }
      
   }
   
   public static void main(String[] args){
      MyThreadClass myThreadClass = new MyThreadClass();
      myThreadClass.start();
      
      MyThreadClass myThreadClass2 = new MyThreadClass();
      myThreadClass2.start();
   }
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     Threads  runnable interface


 Q49. notify(), notifyAll(), wait() are found in which classCore Java
a. java.lang.Object
b. java.lang.Thread
c. java.lang.Runnable
d. java.lang.Implement

Ans.a. java.lang.Object

 Q50. What kind of thread is Garbage collection thread ?Core Java
a. Daemon Thread
b. User Thread
c. System Thread
d. Active Thread

Ans.a. Daemon Thread

 Q51. Which of following is Daemon Thread ?Core Java
a. Thread Scheduler
b. Daemon Thread
c. Both of above
d. None of above

Ans.c. Both of above



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: