© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

Home Placements Interview Questions Java Interview Questions And Answers Java Interview Questions On Thread ▼

Java Interview Questions On Thread

8. Explain different way of using thread?

Answer
The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritance..the only interface can help.

9. What is multithreading?

Answer
Multithreading means various threads that run in a system

10. How does multithreading take place on a computer with a single CPU?

Answer
The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially

11. How to create multithread in a program?

Answer
You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run() method and call start() method to start the thread.

12. Can Java object be locked down for exclusive use by a given thread?

Answer
Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.

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

Answer
When a thread terminates its processing, it enters the dead state

Previous End
1 2
SLogix Student Projects
bottom