Java Final and Immutable

Posted 每天更强一点...

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java Final and Immutable相关的知识,希望对你有一定的参考价值。

1. Final keyword

Once a variable X is defined final, you can‘t change the reference of X to another object, after the initialization. But you can change the content of X if it‘s mutable.

2. Immutable object

Once an immutable object has been created, you can‘t change the content of it, but you can change the reference of it.

3. Make variables unmodifiable

Use final and immutable together to make a variable not possible to modify neither the contents nor the reference

以上是关于Java Final and Immutable的主要内容,如果未能解决你的问题,请参考以下文章

[Codeforces]862F - Mahmoud and Ehab and the final stage

codechef [snackdown2017 Onsite Final] AND Graph

Hdu-6243 2017CCPC-Final A.Dogs and Cages 数学

andorid storage tatal and free

Dijstra堆优化HDU 3986 Harry Potter and the Final Battle

费用流 ICPC 2016 China Final J. Mr.Panda and TubeMaster