Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Declaring a class "final"

Thread view: 
slippymississippi@yahoo.com - 24 Jan 2006 20:08 GMT
I read this in a Java book, is this a typo?  Shouldn't it be object,
not class?
IchBin - 24 Jan 2006 20:13 GMT
> I read this in a Java book, is this a typo?  Shouldn't it be object,
> not class?

Java Language Specification
Third Edition

8.1.1.2 final Classes
A class can be declared final if its definition is complete and no
subclasses are desired or required. A compile-time error occurs if the
name of a final class appears in the extends clause (§8.1.4) of another
class declaration; this implies that a final class cannot have any
subclasses. A compile-time error occurs if a class is declared both
final and abstract, because the implementation of such a class could
never be completed (§8.1.1.1).

Because a final class never has any subclasses, the methods of a final
class are never overridden (§8.4.8.1).

http://java.sun.com/docs/books/jls/third_edition/html/classes.html#54727
Signature


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

slippymississippi@yahoo.com - 24 Jan 2006 20:17 GMT
Doh... that's right.  "final" is used to prevent others from extending
your class...  I hate it when languages overload keywords like that.

Thanks very much for the reminder!
zero - 25 Jan 2006 11:43 GMT
slippymississippi@yahoo.com wrote in news:1138133863.691641.104400
@g49g2000cwa.googlegroups.com:

> Doh... that's right.  "final" is used to prevent others from extending
> your class...  I hate it when languages overload keywords like that.
>
> Thanks very much for the reminder!

seems to make perfect sense to me.  final means that the
variable/reference/object/class cannot be changed after it's been created.  
Changing an object is done by changing its values, changing a class by
extending it and overriding its methods.  So, final does the same for both.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.