Synchronized data read/write to/from main memory
问题 When a synchronized method is completed, will it push only the data modified by it to main memory, or all the member variables, similarly when a synchronized method executes, will it read only the data it needs from main memory or will it clear all the member variables in the cache and read their values from main memory ? For example public class SharedData { int a; int b; int c; int d; public SharedData() { a = b = c = d = 10; } public synchronized void compute() { a = b * 20; b = a + 10; }