How Java understands object-oriented

Source: Internet
Author: User

Objects have properties and actions, such as people and the height of fat and thin properties, and walking, jumping and other actions. Object-oriented programming we are using this object, we just need to understand this method in use, the specific method of implementation of some of the details do not need us to know. Like driving, we know that stepping on the accelerator is accelerating, As for the principle of stepping on the accelerator, we don't need to know, because we're not learning machinery. So when we call the method of the object, we know what arguments go in, and then return what results to us.

There are three main features of object-oriented

1. Encapsulation

To encapsulate some of the implementation details, such as when we use a computer, we move the mouse, hit the keyboard, we can achieve the desired effect, but the specific implementation of the part has been encapsulated, do not need us to understand.

2. Inheritance

The function of the parent class is also inherited, which can increase the reusability of the code.

3. polymorphic

If you use interfaces and abstract classes to make reference types, when objects inherit abstract classes or implement interfaces. Then this object is equivalent to a variety of forms. When the implementation class changes, you only need to modify the implementation class, the other code will not need to modify,

If you use factory-produced objects, you only need to modify the method of the factory class, and the code for this class does not need to be modified. It's like helicopters and civil aircraft are planes, they all have take-off action, so you can add a takeoff method on the interface plane. When the aircraft type is changed, There is no need to modify the method that calls the plane to take off.

How Java understands object-oriented

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.