Immutable class in java

后端 未结 3 991
傲寒
傲寒 2020-12-19 04:15

I made my class immutable by following all java standards

A. Defined class as final
B. declared all fields as private and final
C. No setter method
D. No met         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 05:10

    Yes, still it can be modified through reflection. Apart from that it seems you took required care to make it immutable.

提交回复
热议问题