Sub Class method call

When the Subclass method is called, does the SuperClass constructor execute? If so, which Constructor executes first (Sub Class OR Super Class) for the given below scenarios?
a. Given that we are NOT inheriting SuperClass constructor?
b. Given that we are inheriting SuperClass constructor?

Showing Answers 1 - 6 of 6 Answers

Super class constructor could be invoked only when super() is used and it has high priority of invoking, once super class constructor is invoked the setted public/protected variables are inherited in subclass

  Was this answer useful?  Yes

Shrimp

  • Apr 1st, 2016
 

When a sub class method is called from parent class, constructor will be executed dude, constructor only executed when you create an object

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions