Big Data-java Foundation -6day

Source: Internet
Author: User

Adapter mode

------------------------------------

1, if the interface in a number of methods, and in the use of the interface is only concerned about one or several of the methods, if the conventional way, you need to implement each method, you can create a class to implement the interface, do not care about the method of empty implementation, the method of care remains unchanged, the definition of the new class inherits the abstract class, This is known as the adapter pattern, which is commonly used in the handling of button click events in UI design.

Polymorphic

--------------------------------------

1. Use the object defined by the parent class to refer to the child class. The interface is also polymorphic

2. Prerequisites:

* need to inherit or implement

* Actions that need to be overwritten.

The most important attribute in the 3.java is that all the data exists in the attribute, and the method is just a stack, and it pops up after execution.

Properties cannot be overridden and methods can be overwritten.

4. The number of stacks depends on the number of threads (one thread corresponds to one stack), and the entire Java program has only one heap area.

5. Characteristics of polymorphism

member functions

Compile-time

To view the class to which the reference variable belongs

Run-time

Member variables

See only the class to which the reference variable belongs

Inner class

-------------------------------------------------------

Features: Inner classes can access members of external classes, including private members


Big Data-java Foundation -6day

Related Article

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.