Final variable manipulation in Java

前端 未结 11 795
无人及你
无人及你 2020-11-28 23:28

Could anyone please tell me what is the meaning of the following line in context of Java:

final variable can still be manipulated unless it\'s immut

11条回答
  •  遥遥无期
    2020-11-28 23:59

    You cannot change what object or value a final variable refers to. You can only assign a final variable once.

    This has no effect on whether you can change the state of the object. The object itself can still be manipulated unless it is coded in such a way that this manipulation is forbidden. An immutable object is an object whose state cannot change.

提交回复
热议问题