Question
Question: Which of the following statements about Java's concurrency model and thread safety is correct? A) The synchronized keyword ensures that only one thread can
Question: Which of the following statements about Java's concurrency model and thread safety is correct?
A) The synchronized keyword ensures that only one thread can access a method at any time, but it does not provide visibility guarantees for shared variables.
B) Immutable objects in Java are inherently thread-safe because their state cannot change after construction.
C) The ReentrantLock class provides a simpler alternative to synchronized blocks with no additional features.
D) Using the ThreadLocal class allows multiple threads to share the same instance of a variable.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The detailed answer for the above question is provided below The correct statement is B Immutable objects in Java are inherently threadsafe because th...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started