Final (Java): Difference between revisions

Content deleted Content added
m Just add link
Tags: citing a blog or free web host Reverted Visual edit Mobile edit Mobile web edit
Undid revision 1010925661 by Mouad404 (talk)
Line 3:
 
Once a <code>'''final'''</code> variable has been assigned, it always contains the same value. If a <code>'''final'''</code> variable holds a reference to an object, then the state of the object may be changed by operations on the object, but the variable will always refer to the same object (this property of <code>'''final'''</code> is called ''non-transitivity''<ref>{{cite journal|last1=Coblenz|first1=Michael|last2=Sunshine|first2=Joshua|last3=Aldrich|first3=Jonathan|last4=Myers|first4=Brad|last5=Weber|first5=Sam|last6=Shull|first6=Forrest|title=Exploring Language Support for Immutability|journal=The 38th International Conference on Software Engineering|date=14{{ndash}}22 May 2016}}</ref>). This applies also to arrays, because arrays are objects; if a <code>'''final'''</code> variable holds a reference to an array, then the components of the array may be changed by operations on the array, but the variable will always refer to the same array.<ref>Java Language Specification #4.12.4</ref>
 
for more information visit Us [https://programobile.blogspot.com/2021/03/static-and-final-in-java.html?m=1 here]
 
==Final classes==