mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-07-28 12:22:17 +08:00
Compare commits
No commits in common. "7b22f0a16643984a09f2e4041622fb3a60a7218f" and "f63f39f068a61d20790f14b1e8771b26322ea685" have entirely different histories.
7b22f0a166
...
f63f39f068
@ -475,8 +475,8 @@ synchronized static void method() {
|
||||
|
||||
对括号里指定的对象/类加锁:
|
||||
|
||||
- `synchronized(object)` 表示进入同步代码块前要获得 **给定对象的锁**。
|
||||
- `synchronized(类.class)` 表示进入同步代码块前要获得 **给定 Class 的锁**
|
||||
- `synchronized(object)` 表示进入同步代码库前要获得 **给定对象的锁**。
|
||||
- `synchronized(类.class)` 表示进入同步代码前要获得 **给定 Class 的锁**
|
||||
|
||||
```java
|
||||
synchronized(this) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user