Java Threading Question and Answers

5. Can you explain Yielding in threading?
  It causes the currently executing thread object to temporarily pause and allow other threads to execute.
 
Your Name Your Email-ID
Your Answer
6. What is thread safety and synchronization?
 
  • Thread safe is used to describe that can run safely in multithreaded environments allowing accessing to data in a safe and efficient way.
  • Thread safety is achieved by synchronization.
  • Synchronization assures that the object data is not accessed by multiple threads at the same time.
 
Your Name Your Email-ID
Your Answer
7. How to stop a thread?
  thread.stop;
 
Your Name Your Email-ID
Your Answer
8. What are monitors?
  Monitor is a body of code which can be executed by only one thread at a time. If any other thread tries to get access at the same time, it will be suspended until the current thread releases the monitor.
 
Your Name Your Email-ID
Your Answer
1234567 Page 2 of 7