aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes final class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "final class" Watch "final class" New topic
Author

final class

Praveena khandavalli
Greenhorn

Joined: Jan 05, 2002
Posts: 21
the following statement is true...but how?
can anyone explain please
all methods declared in a final class are implicitly final and hence cannot be
overridden.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
In order to override you would have to be writing a subclass - impossible with a class declared final.
Praveena khandavalli
Greenhorn

Joined: Jan 05, 2002
Posts: 21
thanx william
Jason Kretzer
Ranch Hand

Joined: May 31, 2001
Posts: 280
The final keyword ALWAYS makes things immutable once they have been declared and initialized. At least that is what I have read so far. Are there any exceptions?
[ January 09, 2002: Message edited by: Jason Kretzer ]

Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
There is a little trap for those programmers expecting that final static fields are unique in a class. If the same class is loaded several times by diferent class loaders in diferent name spaces, there would be several copies of those fields.
A bit off topic though. Just mentioned for you to consider in the future
[ January 09, 2002: Message edited by: Jose Botella ]

SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: final class