Final (Java): Difference between revisions

Content deleted Content added
Removed sentence "Restricted subclasses are often referred to as "soft final" classes". This comes from Eclipse documentation, and does not apply to Java generally. These terms to not occur in the Oracle documentation.
KANGOD (talk | contribs)
m Blank final: Update a broken reference link.
Line 124:
===Blank final===
 
The '''blank final''', which was introduced in Java 1.1, is a final variable whose declaration lacks an initializer.<ref>{{cite book|last=Flanagan|first=David |title=Java in a Nutshell|url=http://web.deu.edu.tr/doc/oreily/java/javanut/ch05_06.htm|edition=2nd|date=May 1997 |publisher=O'Reilly|isbn=1-56592-262-X|chapter=Chapter 5 Inner Classes and Other New Language Features:5.6 Other New Features of Java 1.1}}</ref><ref>{{cite web|url=http://javadocs.sunoracle.com/docsjavase/booksspecs/jls/second_editionse8/html/typesValues.docjls-4.html#jls-4.12.4|title=Chapter 4. Types, Values, and Variables|year=20002015|work=The Java® Language Specification Chapter(Java 4SE 8 Edition)|publisher=SunOracle MicrosystemsAmerica, Inc.|accessdateaccess-date=23 JulyFeb 20102015}}</ref> A blank final can only be assigned once and must be unassigned when an assignment occurs. In order to do this, a Java compiler runs a flow analysis to ensure that, for every assignment to a blank final variable, the variable is definitely unassigned before the assignment; otherwise a compile-time error occurs.<ref>{{cite web|url=http://java.sun.com/docs/books/jls/second_edition/html/defAssign.doc.html|title=Definite Assignment|year=2000|work=Java Language Specification|publisher=Sun Microsystems, Inc.|accessdate=23 July 2010}}</ref>
 
==C/C++ analog of final variables==