Abstract:
The elephant is a little vague meaning, not yet definite good meaning.
For example, to define a method and a class. But I'm not sure how to implement its specific sub-methods, then I can use abstract classes or interfaces. Specifically how to use, what to do, I do not care, by the use of the person to define their own to achieve.
Packaging:
Properties can be used to describe the characteristics of the same class of things, and methods describe the operations that a class of things can do . Encapsulation is the inclusion of commonalities (including attributes and methods) belonging to the same category in a class for ease of use .
Concept:
Encapsulation, also known as information hiding, is the use of abstract data types to encapsulate data and data-based operations together to form an indivisible, independent entity, where data is protected within the abstract data type, as much as possible to hide internal details, leaving only a few external interfaces to connect with the outside. The rest of the system is communicated and interacted with this abstract data type only through authorized operations that are wrapped outside of the data. That is, the user does not need to know the implementation details of an object's internal methods, but can access the object based on the external interface (object name and parameters) provided by the object.
Benefits:
(1) Achieve a professional division of labor. Once the code that implements a particular function is encapsulated into a separate entity, the programmer can invoke it when needed, thus achieving a professional division of labor.
(2) Hide the information and implement the details. By controlling access permissions, you can hide information that you do not want the client programmer to see, such as a customer's bank password that needs to be kept secret and can only develop permissions for that customer.
Inherited:
The acceptance of personality and method of generality, and the attribute and method of individuality
After inheritance, subclasses automatically own the properties and methods of the parent class, but it is particularly important to note that the parent class's private properties and construction methods cannot be inherited.
In addition, subclasses can write their own unique properties and methods, the purpose is to implement the extension of the function, subclasses can also replicate the parent class method is the method of rewriting. It's actually polymorphism.
Concept:
A class inherits another class, and the inherited class is a subclass, and the inherited class is the parent class.
The relationship between subclasses and parent classes is not a parent-child relationship in daily life, but a special and generalized relationship between subclasses and parent classes, which is a is-a relationship, and subclasses are more detailed categories of parent classes. As Class dog extends animal, it can be understood as dog is a animal. Note that when designing inheritance, to allow a class to inherit, the parent class needs to be properly open to access, following the Richter substitution principle, which is to open the extension to the modified closure, that is, the open-close principle.
Benefits:
Implement code reuse.
Polymorphic:
The concept of polymorphism is developed on the basis of encapsulation and inheritance.
Polymorphism is the implementation of a unified behavior on an abstract level, at the level of the individual (concrete), this unified behavior will be due to the individual (specific) characteristics of the characteristics of the implementation of their own behavior. (For an abstract thing, the inner individual can find its own behavior to execute.) )
Concept:
The same thing, calls its same method, the parameter also is same, but behaves differently.
Understand:
Subclasses appear as the parent, but they do it in their own way. Subclasses appear as parent classes need to be transformed (upcast), where the upward transformation is automatically implemented by the JVM and is secure, but the downward transition (downcast) is unsafe and requires casting. When a subclass appears as a parent, its own properties and methods cannot be used.
Java Fundamentals-Four feature understandings (abstraction, encapsulation, inheritance, polymorphism)