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

what are the application of compiler and interpreter for source program

2 Answers  


Differentiate between stringbuffer and string?

1 Answers  


What is replaceall in java?

1 Answers  


why java does not have operator overloading?

2 Answers  


What is procedure overloading?

1 Answers  


How to overcome the exception object reference not set to an instance of object?

1 Answers   Wipro,


Distinguish method overloading and overriding

2 Answers   Tech Mahindra,


What is the main functionality of the remote reference layer?

1 Answers  


Can we restart a thread already started in java?

1 Answers  


What is :: operator in java 8?

1 Answers  


how to java plateform independent?

5 Answers   TCS,


How does split work in java?

1 Answers  


Categories