permaculture playing cards*
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""super" keyword and Kathy Sierra" Watch ""super" keyword and Kathy Sierra" New topic
Author

"super" keyword and Kathy Sierra

ashwin bhawsar
Ranch Hand

Joined: Mar 16, 2011
Posts: 62

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

Joined: Dec 08, 2010
Posts: 1509
    
    5

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).


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
ashwin bhawsar
Ranch Hand

Joined: Mar 16, 2011
Posts: 62

Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "super" keyword and Kathy Sierra