Java Multithreading Question and Answers

29. What is the difference between yielding and sleeping?
 
  • 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.
 
Your Name Your Email-ID
Your Answer
30. What’s new with the stop(), suspend() and resume() method?
  The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
 
Your Name Your Email-ID
Your Answer
31. How to stop a thread?
  thread.stop
 
Your Name Your Email-ID
Your Answer
32. What are daemon threads?
 
  • Daemon threads are designed run in the background. One example of a daemon thread is the garbage collector thread.
  • You can use setDaemon () to mark a thread as daemon.
 
Your Name Your Email-ID
Your Answer
12345678910 Page 8 of 10