Monday, July 5, 2010

The “super” Keyword

Whenever a subclass needs to refer to its immediate superclass, it can do so by use of the keyword super.super has two general forms. The first calls the superclass’ constructor. The second is used to access a member of the superclass that has been hidden by a member of a subclass.

super( ) must always be the first statement executed inside a subclass constructor.

1. super(parameter-list);
2. super.member

No comments:

Post a Comment