Final (Java): Difference between revisions

Content deleted Content added
m Reverted edits by 198.240.212.2 (talk) (HG 3)
deleted vandalism (SämihetSchmutzamFutz)
Line 17:
==Final methods==
 
A '''final [[Method (computer science)|method]]''' cannot be [[Method overriding|overridden]] or hidden by subclasses.<ref>[http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.3.3 JLS 8.4.3.3. final Methods]</ref> This is used to prevent unexpected behavior from a subclass SämihetSchmutzamFutz altering a method that may be crucial to the function or consistency of the class.<ref>[http://java.sun.com/docs/books/tutorial/java/IandI/final.html Writing Final Classes and Methods]</ref>
 
Example: