Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What does it mean that a class or member is final?
What does it mean that a class or member is final?
✍: Guest
A final class can no longer be subclassed. Mostly this is done for security reasons with basic classes like String and Integer. It also allows the compiler to make some optimizations, and makes thread safety a little easier to achieve.
Methods may be declared final as well. This means they may not be overridden in a subclass.
Fields can be declared final, too. However, this has a completely different meaning. A final field cannot be changed after it's initialized, and it must include an initializer statement where it's declared. For example,
public final double c = 2.998;
It's also possible to make a static field final to get the effect of C++'s const statement or some uses of C's #define, e.g.
public static final double c = 2.998;
2013-02-18, 2323👍, 0💬
Popular Posts:
What is CAR (Causal Analysis and Resolution)? The basic purpose of CAR is to analyze all defects, pr...
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]? a[i] == *...
Can each Java object keep track of all the threads that want to exclusively access to it?
What are unadjusted function points and how is it calculated? Unadjusted function points = ILF + EIF...
How To Empty Your Recycle Bin? - Oracle DBA FAQ - Managing Oracle Database Tables If your recycle bi...