• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"super" keyword and Kathy Sierra

 
Ranch Hand
Posts: 62
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
ashvinyin bhawalkar
Ranch Hand
Posts: 62
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic