Question: Question: In Java, what is the impact of marking a method with the synchronized keyword? A) It makes the method execute faster by prioritizing thread
Question: In Java, what is the impact of marking a method with the synchronized keyword?
A) It makes the method execute faster by prioritizing thread execution.
B) It allows only one thread to execute the method at a time, blocking other threads until the method is free.
C) It allows multiple threads to execute the method concurrently, but ensures the same variable is not modified.
D) It disables garbage collection for the objects used within the method during its execution.
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The correct option is B It allows only one thread to execute the method at a time blockin... View full answer
Get step-by-step solutions from verified subject matter experts
