Loading…
Loading…
Ten exam-style questions on thread safety: race conditions and lost updates, volatile, AtomicInteger methods, compareAndSet, synchronized blocks and methods, which object is locked, and the BLOCKED state, with explanations.
Practice questions for the article Java Thread Safety: Race Conditions, volatile, Atomic Classes and synchronized.
Every compile and output claim was checked against a real JDK. Aim for at least 8 out of 10.
Quiz path: step 92. Take the quizzes in this order, after reading each article.
Previous quiz: ExecutorService, Callable and Future (OCP 21)
Next quiz: ReentrantLock, ReadWriteLock and CyclicBarrier (OCP 21)
10 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.