Java Interview Questions - II

Started by sukishan, Jul 15, 2009, 01:33 PM

Previous topic - Next topic

sukishan

Q: Describe synchronization in respect to multithreading.

A: With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.   

Q: Explain different way of using thread?

A: 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.


Q: What are pass by reference and passby value?


A: Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed. 
 
A good beginning makes a good ending