Ask Question
18 April, 16:02

If class C inherits class B. And B has inherited class A. Then while creating the object of class C, what will be the sequence of constructors getting called?

+3
Answers (1)
  1. 18 April, 19:12
    0
    Constructor of A then B, finally C

    Explanation:

    A constructor in Java is a method of initializing objects. The constructor is called when an object of a class is created. It can be used to set initial values for object characteristics.

    In creating the object of class C, its constructor would be called by default. But, if the class is inheriting some other class, firstly the parent class constructor will be called so that all the data is initialized that is being inherited.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “If class C inherits class B. And B has inherited class A. Then while creating the object of class C, what will be the sequence of ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers