File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Overriding final methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Overriding final methods" Watch "Overriding final methods" New topic
Author

Overriding final methods

Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Normally methods declared as final cannot be overriden for security / design reasons.

But when a method declared as "private final" can be overriden in the child class. Do we get this behaviour since private members are not accessible in child ?
[ February 17, 2005: Message edited by: Srinivasa Raghavan ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Private methods in the parent class are not in inherited by the child classes. Hence, having methods of the same signature as well as being declared private & final does not equate to method overriding.

HTH


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Kris Lightsey
Greenhorn

Joined: Feb 03, 2005
Posts: 25
And it is not just a question of semantics. Overridden methods will show polymorphic behavior but redefining private methods with the same name and signature will not.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Overriding final methods