File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we inherit a final method from the subclass?

 
senthil sen
Ranch Hand
Posts: 184
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we inherit a final method from the subclass?
Say i have a mehtod in Class A with is final.
I have a class B which extends Class A.will the final method in the class A be inherited in class B.??
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. You just can't change a final method or field.
Michael Morris
 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless of course the method is private final. (Or package private, i.e., not public, protected, or private, and the superclass and subclass are in different packages.) Then it can't be called by the subclass. Of course, that's true for any method, final or not.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic