[Solved] What does it mean, ‘this’ reference refers to the currently executing object? [closed]


The dilemma here is that “currently executing object” is a very abstract concept that is easy to intuit but hard to describe in writing (at least for me)

If you have a ChildClass, it is also a BaseClass. Therefore, you have a single object in question. Its type is ChildClass, and it can be cast to (and has fields and methods of) BaseClass and Object as well.

this refers to itself. When a ChildClass is instantiated, the initializer:

 this.childMethod();
 this.parentMethod(); 

executes (though in order for the code to compile, it needs to be in a set of braces).

That initializer calls childMethod and parentMethod in that order for the object being initialized.

solved What does it mean, ‘this’ reference refers to the currently executing object? [closed]