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 / 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 |
public class Test { public static void main(String ar[]) { Integer a = 10; Integer b =10; Integer c = 145; Integer d = 145; System.out.println(a==b); System.out.println(c==d); } }
what is main purpose of interface?
2 Answers Accenture, HCL, NIIT,
whats the purposr of using serialization?
What is jit and its use?
how to accept integer array in java
What is the immediate superclass of the Dialog class?
Write a program to print count of empty strings in java 8?
How to create two different thread class inside a main function?
What is data object example?
what is main difference b/w abstract class and interface
can abstract class have constructor how can you achive this ?
What is the difference between Static and final?