MCQ Single Best Answer Easy

QWhat is the command used to call the method named myMethod in the parent class from the child class?

Class myChildClass extends myParentBaseClass
{
Public void myMethod()
   {
_____________();
~~~Body of new code here~~~
   }
}

ID: #9379 Module 13: Classes 260 views
Question Info
#9379Q ID
EasyDifficulty
Module 13: ClassesTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A insert
  • B return
  • C void
  • D super
Correct Answer: Option D

Explanation

Justification:

  1. Insert is not a keyword, but a method on tables. It is not used to call an override method, but to insert data into a table .
  2. Return is not a valid keyword used in inheritance scenarios.
  3. The void keyword is used before a method. This indicates that a given method does not return a value. The void keyword is already used before myMethod().
  4. Super() is the correct call to ensure that the method of the same name, “myMethod” is called.

 

Related Lesson: Class Inheritance

Share This Question

Challenge a friend or share with your study group.