How the threads are synchronized?
Answers were Sorted based on User's Feedback
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 |
Answer / dsr
By using wait(),notify and notifyall() methods in the code.
| Is This Answer Correct ? | 2 Yes | 4 No |
I have a string like _a01_a02_a03_ and another string like _2_1.5_4_ as input.I want to extract a01,a02... to a string array and 2,1.5,etc to a double array with a01 corresponds to 2 and a02 to 1.5 etc. Need code in core java.. Can you do it?
What is the default execution method in java?
In a my eclipse editor if i want to switch from jdk 1.4 to jdk 1.6 how to do that???? Initially i have jdk1.4
What is the function of log?
String class is defined under which package in java?
Can a class be protected in java?
When you declare a method as abstract method ?
What is object-oriented programming?
How does synchronized modifier work?
What is the basic concept of java?
What is string variable?
What data type is string java?