Alternatively, a field may be declared volatile
,
in which case a thread must reconcile its working copy of the field
with the master copy every time it accesses the variable. Moreover,
operations on the master copies of one or more volatile variables on
behalf of a thread are performed by the main memory in exactly the
order that the thread requested. A final
field cannot also be declared volatile
.
volatile
最新推荐文章于 2025-04-23 17:24:59 发布