This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can final methods be over-ridden?

 
ZEESHAN AZIZ
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think they can not be.
But while doing quiz at itcrunch.com, I got a response, that
"You can over ride methods declared final in super class".
How is it possible?
 
abhijit r
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A method that is declared 'final' cannot be overridden in a subclass.
Methods that are declared 'static' and methods that are declared 'private' are implicitly 'final'.
(Java: How to Program - Deitel & Deitel, 3rd Edition, page 410)
You can use the 'final' keyword in a method declaration to indicate to the compiler that the method cannot be overridden by subclasses.
(from Sun's documentation on Java - http://java.sun.com/docs/books/tutorial/java/javaOO/final.html)
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abhijit r,
Please read the JavaRanch Name Policy and re-register using a name that complies with the rules.
Thanks for your cooperation.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!