synchronized锁住的是括号里面的对象,而不是代码。 对于非static的synchronized方法,锁的就是对象本身,也就是this。 相关文章: 2022-12-23 2022-12-23 2023-01-09 2022-12-23 2021-12-05