Can volatile variable be defined as static in java?

后端 未结 5 1462
無奈伤痛
無奈伤痛 2021-02-01 04:36

Can I declare something like this??

static volatile boolean first=false;
5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 05:15

    Sure. The effects of the two modifiers are completely orthogonal.

提交回复
热议问题