• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access to overriden parent method (Java OCA 8 Programmer I Study Guide, Sybex)

 
Miguel Callejón
Greenhorn
Posts: 4
Android Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Boyarsky's manual says the following:
(pg. 254, Overriding vs. Hiding Methods:
At runtime the child version of an overriden method is always executed for an instance regardless of whether the method call is defined in a parent of child class method. In this manner, the parent method is never used unless an explicit call to the parent method is referenced, using the syntax ParentClassName.method()


Could anyone give me an example of the part in bold? Should be that explicit call within the overriding method?

line1: Should it be here? But the syntax is super.method(), not "ParentClassName.method()"?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miguel Callejón wrote:line1: Should it be here? But the syntax is super.method(), not "ParentClassName.method()"?

Yes, it should be there! And yes, the correct syntax is super.method() and not ParentClassName.method(). That's why it was already reported here as an errata item and was added to the official errata overview.

Hope it helps!
Kind regards,
Roel
 
Miguel Callejón
Greenhorn
Posts: 4
Android Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I see! English is not my native language so the first time I read the errata explanation in Selikoff's page I didn't quite get it!
Thank you for such a fast answer!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic