Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Big data-java Foundation-6day

Shulou Source: shulou.com Published: 2022-06-03 07:53:15 10月04日 Update

Adapter mode

-

1. If there are many methods in the interface, but only care about one or more of them when using the interface, if you use the conventional way, you need to implement each method, and you can create a class to implement the interface. Empty implementation of the unconcerned method, keep the concerned method unchanged, after the defined new class inherits the abstract class, you can implement the concerned method. This pattern is called the adapter pattern and is often used in the handling of button click events in UI designs.

Polymorphisms

-

1. Use the object defined by the parent class to reference the subclass. The interface is also polymorphic.

two。 Prerequisites:

* need to inherit or implement

* actions that need to be overridden.

In 3.java, attributes are the most important, all the data is stored in attributes, and the method is just a stack, which pops up after execution.

Properties cannot be overridden and methods can be overridden.

4. The number of stack blocks depends on the number of threads (each thread corresponds to one stack area), and the entire java program has only one stack area.

5. The characteristics of polymorphism

Member function

Compile time

To view the class to which the reference variable belongs

Run time

Member variable

Only look at the class to which the reference variable belongs

Inner class

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

Tags: Methods members interfaces polymorphisms variables properties patterns ownership quantity characteristics threads adapters adaptations data importance events functions premises depends on just Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Docker OPPO Reno Apple