Thursday, March 8, 2012

Challenge 050’s Solution

Of the three, only statement II is true. Statement I states that Teacher will inherit Person’s constructors. However, subclasses do not inherit its superclasses’ constructors; thus, statement I is false. Statement II states that Teacher can create methods and instance variables other than those provided by Person. This is true, as subclasses can create its own methods and instance variables—be they public or private. Finally, statement III states that Teacher can override Person’s private constructors. However, these are private—they cannot be accessed outside of Person. Thus, statement III is false.
 
−Phoenix

1 comment: