How to make a method thread safe without using synchronized
keyword?
Answer Posted / venkat
Hi Jitender,
Here the scnroniziation is happening in methodA(){}
But the same thread(Thread-0) is executing even second time
also. Could you please clarify the same.
Here is the output.
Constructor..
Thread started..Thread-0
processing....Thread-0
Thread started..Thread-1
complete..Thread-0
processing....Thread-0
complete..Thread-0
Regards,
Venkat
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Explain throw keyword in java?
What is the difference between == and === javascript?
When will we use them?
What does the “static” keyword mean? Can you override private or static method in java?
What is the largest number a double can hold?
What is stream api in java8?
What is difference between float and double?
What is backdrop?
What is a default method?
What is proper subset?
How many types of operators are there?
What is r in java?
What are the wrapped, classes?
What is a boolean expression in java?
How do I print a “?