Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Memory Space Allocation and subclasses
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Oscar Kind, post: 552687"] This is also correct for subclasses, but maybe it is slightly clearer if you read it thus: 1. Allocate the memory needed for the entire structure (its own fields, the fields of the superclasses, etc.). 2. Execute the initializer blocks (these include explicit initializations, but there are more possibilities) of Object and its subclasses along the path to (and including) the current subclass (every class is a subclass of Object). 3. Execute the constructor of the current class (which executes the constructors of the superclass in the order you indicated). Note however, that I may be wrong about the order the code is executed for points 2 and 3. I didn't test it. Oscar [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Memory Space Allocation and subclasses
Top