Section B- Indicate TRUE or FALSE for the following statements: (i) A subclass i
ID: 3733535 • Letter: S
Question
Section B- Indicate TRUE or FALSE for the following statements: (i) A subclass is a subset of a superclass. (i) The private members of a superclass can directly access by the subclass (iii) An instance of a subclass is always an instance ofa superclass. (iv) A final method in a superclass can be overridden. (v) A subclass cannot override methods that are declared static in the superclass. (vi) Polymorphism is the technique of using the different method name to indicate different implementations. A subclass inherits all the data and methods of its superclass, except the private ones When you create any subclass object, the subclass constructor must execute first, (vii) (viii) and then the superclass constructor executes. The keyword extends is used to access the parent class method The keyword super is used to indicate the inheritance. (ix) (x) (10 marks) acerr V-31Explanation / Answer
1) False
A Subclass
i. Inherit the properties of its base or super class
ii. The subclass may not inherit all the properties of the base class and is free to implement its own functionality
iii. Sub class can inherit the property but the superclass cannot use the properties of base class
Therefore subclass is not a subset of Superclass.
2)False
The subclass cannot direclty access the private members of Superclass, although the Object of Subclass have the private members of the super class.
3) True
While initializing the object of subclass the constructor of superclass is called first. Therefore an instance of a subclass is always an instance of a superclass.
4) False
Final keyword is use to ensure that the property cannot be overridden by other classes.
5) False
Static method are not polymorphic in nature, because only single copy of static method are shared among the resources.
6) False
Polymorphism is the technique of using the same method name to indicate different implementations, where each method is distinguished by the list of parameter or order of parameter it takes as input.
7) True
8) False
First the constructor of superclass is executed and then the constructor of subclass is executed.
9) False
Extends keyword is use to inhert superclass in subclass, whereas super keyword is use to access the parent class method.
10) False
Extends keyword indicate inheritance, super keyword is use to call the method of immediate superclass.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.