Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

SAP C_ABAPD_2507 Exam - Topic 1 Question 20 Discussion

Actual exam question for SAP's C_ABAPD_2507 exam
Question #: 20
Topic #: 1
[All C_ABAPD_2507 Questions]

You have a superclass super1 and a subclass sub1 of super1. Each class has an instance constructor and a static constructor. The first statement of your program creates an instance of sub1.

In which sequence will the constructors be executed?

Show Suggested Answer Hide Answer
Suggested Answer: B

Execution order when creating an instance of a subclass:

Class constructor of the superclass (super1) executes first.

Class constructor of the subclass (sub1) executes second.

Then the instance constructor of the superclass (super1) executes.

Finally, the instance constructor of the subclass (sub1) executes.

This sequence guarantees that both the static (class-level) and instance-level initializations of the superclass are complete before the subclass is constructed.

Verified Study Guide Reference: ABAP Objects Programming Guide -- Class and Instance Constructor Execution Order.


Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel