How to make a method thread safe without using synchronized
keyword?
Answer Posted / dandhar
Make the "inUse" variable to static.
private static boolean inUse = false;
Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
What is the difference between a static and a non-static inner class in java programming?
Can a lock be acquired on a class in java programming?
why Interface used?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
How do you sort words in java?
What is the difference between an object-oriented programming language and object-based programming language?
What is the use of toarray () in java?
Is a char always 1 byte?
What is the exact difference in between unicast and multicast object? Where we will use?
how can you catch multiple exceptions in java?
Why put method is idempotent?
What is a get method?
Explain inheritance in java?
What is difference in between java class and bean?
What makes a function well defined?