• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"super" keyword and Kathy Sierra

 
ashwin bhawsar
Ranch Hand
Posts: 62
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was going through the "Invoking a Superclass version of an Overriden Method" topic on page no 107 of SCJP (Exam 310 - 065 ) book.

If i am not wrong it says that you can only invoke the super-class methods using "super" keyword from its overriden version.
Also there is a note at the end that says " Note: Using super to invoke an overridden method only applies to instance methods. "

But i am able to invoke all kinds of methods using "super" keyword. I can even invoke static, final methods of the super class.
Someone can please explain me what is happening.



Output:
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: Using super to invoke an overridden method only applies to instance methods.

That is right. Because final and static methods cannot be overridden. What you are doing is - simply invoking a super class' method - not an overridden method (e.g. walk and makesound are not overridden).
 
ashwin bhawsar
Ranch Hand
Posts: 62
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic