Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes disable override Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "disable override" Watch "disable override" New topic

disable override

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
the scenario is

I have a classA with some public methods (used by other composite classes), but I don't want those methods get overide in classB when classB extends classA.

is that possible? maybe I need to re-design, if so, how?

many thanks

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
If a method is declared final, it can't be overridden.
I agree. Here's the link:
subject: disable override
It's not a secret anymore!