Java Small Note (i)

Source: Internet
Author: User

The issues you need to be aware of in Java for up-transformation, down-conversion, and internal classes:

Upward transformation and downward transformation:

For example: There are 2 classes, Father is the parent class, and the son class inherits from father.

Father f1 = new Son (); This is called upcasting (upward transformation)

Now the F1 reference points to a son object

son S1 = (son) F1; This is called downcasting (downward transformation)

Now F1 still point to son object

But we cannot do this when we are going down the transition:

Father F2 = new Father ();

Son s2 = (son) F2; Error, subclass reference cannot point to parent class object

Inner class:

When you create an inner class, you must use an object from the outer class to create

Java Small Note (i)

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.