Thread Synchronization protects access to _____.
-
Code
-
Data
-
Both
-
None of these
A
Correct answer
Explanation
Thread synchronization in Java protects access to shared data by controlling which threads can enter critical sections (code blocks accessing shared data). While the synchronized keyword guards code blocks, the ultimate purpose is protecting shared data from concurrent modification. Option A is somewhat narrow but acceptable as synchronization controls code entry.