国产成人毛片视频|星空传媒久草视频|欧美激情草久视频|久久久久女女|久操超碰在线播放|亚洲强奸一区二区|五月天丁香社区在线|色婷婷成人丁香网|午夜欧美6666|纯肉无码91视频

synchronized三種用法 java synchronized鎖對象,當(dāng)對象引用是null的時候,鎖的是什么?

java synchronized鎖對象,當(dāng)對象引用是null的時候,鎖的是什么?謝邀!Java語言規(guī)范中明確指出如果鎖住的對象是null,則會NullPointerException,規(guī)范內(nèi)容如下:

java synchronized鎖對象,當(dāng)對象引用是null的時候,鎖的是什么?

謝邀!

Java語言規(guī)范中明確指出如果鎖住的對象是null,則會NullPointerException,規(guī)范內(nèi)容如下:

The type of Expression must be a reference type, or a compile-time error occurs. A synchronized statement is executed by first evaluating the Expression. Then: If evaluation of the Expression completes abruptly for some reason, then the synchronized statement completes abruptly for the same reason. Otherwise, if the value of the Expression is null, a NullPointerException is thrown.