I can't understand a thing about debugger even after reading some articles and watching tutorials on youtube.
HELP!!!
Under discussion
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Gellert Varga
19 June 2021, 18:02
I rarely use IntelliJ, so I can't explain the debugger.
But if you want to understand this task, Guadalupe explains it well at this link, under the task, in his post dated 8 April 2020:
https://codegym.cc/tasks/com.codegym.task.task15.task1526
0
Gellert Varga
19 June 2021, 18:34
I had to write myself some serious notes in relation to this exercise, because I had to learn a lot from it.
I'm copying it for you.
(I think that a clear understanding of the following is very important in dealing with this task.)
When you create a new object:
1) It starts by creating the variables in the child class, and going up on the inheritance chain from the bottom to the top through all parent classes all the way to the Object class, creating and setting all the variables in all classes to default (to zeros and to null-s)
(both static and non-static!)
(The child class instance variables already exist and store default values at that moment when the JVM is still working in the parent class constructor! We'll face this in the Task-1526 [debug, debug].)
2) in the parent classes, going down on the inheritance chain, initializing the static variables to the values given in the code and executing static blocks. In the order of occurrence in the code.
Finally, it does the same things in the child class at the very bottom of the chain.
3) in the parent classes, going down the inheritance chain, it does the following in each class:
a) initializes all the instance variable to the values specified in the code and executes the non-static blocks. (This is not the constructor!) In the order of occurrence in the code.
b) after all of this, executes the constructor.
In the end, it also does all of this inside the child class at the bottom of the chain.
If we'll create already the second or umpteenth object from the same class, point 2 is skipped.
0
Gellert Varga
19 June 2021, 18:35
Phrasing the above a little differently:
1) creating of child-class, and to set all variables to the default (both of static and nonstatic)
2) creating of parent-class, and to set all variables to the default (both of static and nonstatic)
3) in the parent class: initializing static variables to the values given in the code, and executing static blocks.
4) in the child class: initializing static variables to the values given in the code, and executing static blocks.
5) in the parent class: initializing instance variables to the values given in the code, and executing nonstatic-blocks.
6) executing the parent class constructor.
7) in the child class: initializing instance variables to the values given in the code, and executing nonstatic-blocks.
8) executing the child class constructor.
+2
John
20 June 2021, 01:48
Thank you Gellert ;)
0