synchronized method will lock the object, so other synchronized methods will not be invoked. This will prevent many methods to modify the same memory area at the same time.
synchronized method will lock the object, so other synchronized methods will not be invoked.This will prevent many methods to modify the same memory area at the same time.