Jdkdbdb2893 Jdkdbdb2893
  • 02-03-2020
  • Computers and Technology
contestada

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?

Respuesta :

Myth8
Myth8 Myth8
  • 04-03-2020

Answer:

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.

Answer Link

Otras preguntas

Which of the following statements best describes the formation of volcanoes?
What happened to Old Major? A. He died peacefully in his sleep. B .Mr. Jones sent him to a neighboring farm. C. Mr. Jones killed him for the meat. D. Mr. Jones
To apply for a job at the new store in the mole. is this a fragmentation sentence ​
pls pls help whoever gets it right gets a crown
what is the meaning of a hybrid seed
Location B is which place? Canaan Egypt Syrian Desert Mediterranean Sea
i hate this brainly thing so so so much
A barbar wants to set up a salon in a room measuring length of 3m by 3m .He has a simple wooden chair,3 large mirrors and one bulb . a) using the knowledge of s
im sad and depressed because i just got called to the library to get told i didnt mke the team for the battle of the books
evaluate this equation (-5)^5/(-5)^-6