Answer Posted / maninder kaur
thread locking is achieve by synchronized keyword.
for eg...
public synchronized void disp()
{
}
or
public void disp()
{
synchronized(this)
{
}
}
it makes a lock on disp method until we comes to the end of the block.
so that no other thread can modify it.
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
How do you remove all elements from an arraylist in java?
What is the difference between integer parseint and integer valueof?
How does predicate work in java?
What is hashmap in java?
Can we define private and protected modifiers for the members in interfaces?
What does file separator do in java?
What is the default access specifier for variables and methods of a class?
How do you calculate roots in java?
What is sizeof () operator?
What are static variables and functions?
What is bytecode in java ?
How arrays are stored in memory in java?
What are synchronized blocks in java?
Can private class be extended java?
Which is bigger float or double java?