开发者

volatile vs. synchronize, which one for objects? [duplicate]

开发者 https://www.devze.com 2023-03-12 14:49 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicates: Difference between volatile and synchronized in JAVA (j2me)
This question already has answers here: Closed 11 years ago.

Possible Duplicates:

Difference between volatile and synchronized in JAVA (j2me)

Difference between synchronization of field reads and volatile

According to java documentations, I f开发者_如何学Goound volatile works like synchronized about objects. I was wondering if volatile is faster than synchronized or not? or it would cause any side effect to use volatile instead of synchronized keyword?

0

精彩评论

暂无评论...
验证码 换一张
取 消