Computer Science, asked by nahmednida7641, 11 months ago

Interpret which of the following statements are correct with respect to inheritance relationship in java? Select one or more: a. object of subclass referenced by super class type can invoke super class methods b. object of subclass referenced by super class type can invoke newly defined sub class methods c. object of subclass referenced by super class type can access newly defined sub class variables d. object of subclass referenced by super class type can access super class variables e. object of subclass referenced by super class type can invoke overridden sub class methods

Answers

Answered by syed2020ashaels
1

Answer:

(a) Object of subclass referenced by superclass type can invoke superclass methods.

(d) Object of subclass referenced by superclass type can access superclass variables.

(e) Object of subclass referenced by superclass type can invoke overridden subclass methods.

Explanation:

  • We know that "Inheritance in Java" is a concept that obtains or acquires the properties from one class to another. The bond shared by a father and a son can be an apt instance in this regard.
  • A class can easily inherit attributes as well as methods from another class in Java.
  • The subclass is the class that will inherit the properties. It is also called the child class.
  • On the other hand, the superclass is the class from which the methods and properties are inherited. It is also called the parent class.
  • The methods and properties of the base class are obtained by the derived classes in inheritance.

#SPJ2

Similar questions