Java to do the title notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.