Jump to content

Talk:Final (Java)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Smallman12q (talk | contribs) at 02:08, 4 July 2010 (Blank final: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconJava Start‑class Mid‑importance
WikiProject iconThis article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
MidThis article has been rated as Mid-importance on the project's importance scale.

This page was all wrong about final variables.

First, they are not like "const" in C++ since in that language a const field is limited not only to not being reassigned, but there is the additional limitation that only const methods can called on it and it can only be passed as the const argument of other methods.

Second, (non-static) inner classes can freely access any field of the enclosing class, final or not.


Final Local Variables and Arguments

Arguments and local variables can also be declared final. I'm not entirely sure how it works, but I think it should be included in this article.

Thejoshwolfe (talk) 07:53, 21 November 2008 (UTC)[reply]

  • the same applies to local variables (and function arguments) as to class fields: They must be assigned to at most once (and must be assigned to before being used). Arguments are already assigned when the function body entered. 78.102.120.26 (talk) 06:53, 5 March 2009 (UTC)[reply]

Blank final

Anybody want to add something about blank finals? Otherwise I'll add it at the end of next week when I will have a lot more time.Smallman12q (talk) 02:08, 4 July 2010 (UTC)[reply]