Final (Java): Difference between revisions

Content deleted Content added
Ezrarez (talk | contribs)
m spelling
Added {{Javadoc:SE}} links
Line 1:
In the [[Java programming language]], the <code>'''final'''</code> [[Keyword (computer)|keyword]] is used in several different contexts to define an entity which cannot later be changed.
 
A '''final [[Class (computer science)|class]]''' cannot be [[Subclass (computer science)|subclassed]]. This is done for reasons of security or efficiency. Accordingly, many of the Java standard library classes are final, for example [http{{Javadoc://SE|package=java.sun.com/j2se/1.5.0/docs/api/lang|java/lang/|System.html java.lang.System]}} and <code>[[{{Javadoc:SE|package=java.lang.|java/lang|String]]</code>}}. All methods in a final class are implicitly final.
 
Example:
Line 20:
 
public class MyClass {
public static final floatdouble PI = 3.1415141592653589793;
}