How the threads are synchronized?

Answers were Sorted based on User's Feedback



How the threads are synchronized?..

Answer / seshadri pera

Threads are synchronized in two ways.

1) block level
2) Method level

Block level synhronization is the better performance
compare to method level.

Block Level:
see the code syntax for block level
synchronized {..
....//code to lock the specific object here..
...}

Method Level:
See the syntax
public void synchronized XXXMethodName(Parameters or
object to acquire locking){.....
...}

Is This Answer Correct ?    7 Yes 1 No

How the threads are synchronized?..

Answer / dsr

By using wait(),notify and notifyall() methods in the code.

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More Core Java Interview Questions

Implementations of set interface?

0 Answers  


Why is logger singleton?

0 Answers  


What is the purpose of garbage collection in java?

0 Answers  


different types of threads?

18 Answers   TCS,


Explain about field hiding in java?

0 Answers  






what is thread? What are the high-level thread states? : Java thread

0 Answers  


What does pointer mean?

0 Answers  


Why we can not force Garbage Collection?

7 Answers  


Distinguish method overloading and overriding

2 Answers   Tech Mahindra,


What is protected and friendly?

1 Answers  


What is an enumeration class?

2 Answers  


Can we restart a thread already started in java?

0 Answers  


Categories