1.同步代码块(隐式锁)
2.同步方法(隐式锁)
3.同步锁Lock(java1.5以后)
粘贴一个博主写的
https://blog.csdn.net/qq_38974634/article/details/81292061