AF
Home
Tag
Submit Notes
Ask Anything
Login
Subscribe Us
A
ny
F
orum
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.
Follow @anyforumin
corejava-inheritance: How many objects will be created in multilevel inheritance?
class A{
}
class B extends A{
}
class C extends B{
public static void main(String s[]){
C c =new C();
}
}
If i create a object of class C then how many objects would be created internally?
corejava x 353
inheritance x 7
Posted On :
2014-05-14 17:10:55.0
Saksham Kumar
734
339
36114
-3
Answers
Only one object will be created that is of class C only. The concept is whenever a child class constructor is called it calls its parent class constructor. super() is by default inserted in child class constructor. It doesn´t mean that a separate parent class´s object will be created. It is to include the property or behaviour of parent class in child class object, that´s it.
Posted On :
2014-05-14 17:23:33
Satisfied :
3 Yes
1 No
Rishi Kumar
523
1882
45674
Reply This Thread
4
Post Answer
Please Login First to Post Answer:
Login
Answer:
anyforum.in