Hi Friends, I am new to java. Can u explain about thread
concept.How i know one thread is locked, and how can i force
or acquire another thread for lock . Finally how to know
thread is released from lock. Explain types of lock(like
method level and block level) in thread.

Answer Posted / ravikiran

Thread is a sequential flow of control

With the help of wait(),notify(),notifyAll() methods from
the Object class

We can force a thread to be locked by making the object to
be synchronized or putting the code inside a synchronized block

We will got to know the unlocking status with the help of
notify / notifyAll method calls.

Method level block will provide a lock for the whole method
access.Block level lock will lead to a particular portion of
a program to be get locked.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the static variable?

576


Explain about serializable interface in java?

586


what is meant by HQL?

645


What is the nested interface?

601


Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?

547






What is the maximum size of a string in java?

553


What are the types of collections in java?

543


How does remove work in java?

526


does java support pointers?

568


What is a class reference?

555


What is the difference between pass by reference and pass by pointer?

504


Explain the difference between arraylist and linkedlist in java?

486


Is a class subclass of itself?

608


Can arraylist contain null values?

568


What do you mean by buffering?

561