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

Explain the pointers in Java?

590


What is not thread safe?

485


what is meant by Garbage collection?

616


What is array pointers ?

599


What does super keyword do?

552






Can we change the scope of the overridden method in the subclass?

836


What is the difference between math floor and math round?

493


How many types of classes are there in java?

511


Does java return by reference?

529


What is polymorphism java example?

536


Difference between method overloading and overriding.

575


Difference between concurrent hashmap and hashtable and collections

559


How do you reverse sort in java?

496


What are green threads in java?

550


What are synchronized methods ?

608