Answer Posted / 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 |
Post New Answer View All Answers
Difference between static and dynamic class loading.
What do you understand by the term singleton?
What is meant by method?
Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?
Explain about complier design(phases)
What is the use of keywords in java?
What is are packages?
Explain the features of java?
Which class is used by server applications to obtain a port and listen for client requests?
What is lexicographically smallest string?
4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (
What is the biggest integer?
What is meant by tab pans?
What is a null class?
What do you understand by copy constructor in java?