Clarification on the meaning of the parameter block synchronization
问题 i would like to know if this expression it is correct and if it means this: i put a write lock over the field status, and than i change it. If not, i would like to know what is the meaning of the paramenter, because i see always this . public class Example { private int status; public Example(int status){ this.status = status; } public void setStatus(int newStatus){ synchronized(this.status){ this.status = newStatus; } } } 回答1: There are several things wrong with this code: You cannot