In the real world, objects are objects, objects are entities that exist, such as human beings, desks, computers, high-rise buildings, etc. The way human beings solve problems is always to simplify the complex things, and then think about what these objects are made of. Objects are usually divided into two parts, the dynamic and the static ones. Static part, as the name implies, is an active part, this part is called "attribute", any object will have its own attributes, such as a person, it includes height, weight, gender, age and other attributes. However, those who have these attributes will perform what actions are also a part of the discussion, the person can cry, smile, talk, walk, these are the behavior of this person (dynamic part), the human by exploring the properties of objects and observe the behavior of objects to understand the object.
Class is the carrier of the property and behavior of the encapsulated object, whereas a class of entities with the same properties and behaviors are called classes. For example, a bird, a bird that encapsulates the common attributes of all birds and the behavior it should have, its structure. Encapsulation encapsulation is the core idea of object-oriented programming, encapsulates the properties and behaviors of objects, and the carrier that encapsulates the properties and behaviors of objects is the class, and the class usually hides its implementation details to the customer, which is the encapsulation idea. For example, a user who uses a computer can do something with a finger-tapping the keyboard, and the user does not need to know how the computer works, even if the user may happen to know how the computer works, but does not rely entirely on the details of how the computer works when using the computer. Iv. inheritance
Classes also have a relationship with classes, such as a department store class that is associated with a salesperson class, which is called an association between classes. Correlation is a general two-dollar relationship between two classes, such as a department store class and a salesperson class that is an association, and then the student class and the teacher class are also an association. There are many kinds of relationships between two classes, and inheritance is one of the associations.
V. Polymorphism
Polymorphism allows programs to be written in a uniform style to handle a wide variety of existing classes and related classes. The uniform style can be implemented by the parent class, and the object of the subclass can be instantiated according to the uniform style of the parent class. As the whole event is only dependent on the method of the parent class, it is possible to maintain and adjust the parent class's methods later, which reduces the difficulty of maintenance and saves time.
When it comes to polymorphism, you have to mention abstract classes and interfaces, because polymorphic implementations do not rely on specific classes, but rather on abstract classes and interfaces.
How Java understands object-oriented