Java to do the title notes
The initialization process is this:
1. First, initialize the static member variables and static code blocks in the parent class, initializing them in the order in which they appear in the program;
2. Then initialize the static member variables and static code blocks in the subclass, initializing them in the order in which they appear in the program;
3. Second, initialize the normal member variables and code blocks of the parent class, in the execution of the parent class construction method;
4. Finally, initialize the subclass of the ordinary member variables and code blocks, in the execution of the subclass of the construction method;
(1) Initialize the normal member variables and code blocks of the parent class and execute c c = new C (); Output C
(2) Super ("B"); Represents the constructor method that calls the parent class, does not call the parent class's parameterless constructor, and the output B
(3) System.out.print ("B");
So output CBB
Remember: Whatever the finally statement is going to do, that's the problem.
The finally statement is executed after the return statement in the try or catch is executed and the modified statement in finally does not affect the return value that has been determined in the try or catch. If there is a return statement in Finally, the return statement in the try or catch is overwritten directly. (Students can actively explore OH)
Inally is bound to be executed in two cases:
There is a return statement in 1.finally, and the code in the finally is executed when the try executes to return, where return is returned directly, title, with a return value of 3.
2.finally does not contain a return statement, then when executed to return, it will be saved waiting for finally to return after the execution, this time, no matter how the value of the finally internal changes, will not affect the return result! Such as:
Java to do the title notes