Ask Question
10 September, 07:21

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?

+2
Answers (1)
  1. 10 September, 07:50
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers