Are final static variables thread safe in Java?

前端 未结 8 881
盖世英雄少女心
盖世英雄少女心 2020-12-13 06:40

I\'ve read around quite a bit but haven\'t found a definitive answer.

I have a class that looks like this:

    public class Foo() {

        private          


        
8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 07:11

    At this case only sharedData object is immmutable, that means only that all the time you will work with same object. But any data inside it can be changed (removed, added, etc) at any time, from any thread.

提交回复
热议问题