卖逼视频免费看片|狼人就干网中文字慕|成人av影院导航|人妻少妇精品无码专区二区妖婧|亚洲丝袜视频玖玖|一区二区免费中文|日本高清无码一区|国产91无码小说|国产黄片子视频91sese日韩|免费高清无码成人网站入口

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.