September 2011
Beginner
650 pages
15h 47m
English
A subclass can call a constructor defined by its superclass by use of the following form of super:
super(parameter-list);
Here, parameter-list specifies any parameters needed by the constructor in the superclass. super( ) must always be the first statement executed inside a subclass constructor. To see how super( ) is used, consider the version of TwoDShape in the following program. It defines a constructor that initializes width and height.


Here, Triangle( ) calls super( ) with the parameters w and ...
Read now
Unlock full access