Java object-oriented-the basic concept of object-oriented programming

Source: Internet
Author: User

The concept of object-oriented is defined by many definitions in each book.

I myself according to my experience, the archive summarizes the next,

Object-oriented is to analyze and solve problems with object-based thinking, everything is object;

Object-oriented often and process-oriented discussions;

Here, for example,

For example, to build a bicycle, if the process-oriented thinking, Zhang San first to engage in wheels,

John Doe again engage in the frame, Harry again to do chain, Zhao Liu again make foot pedal ... The final piece pieced together, make a car that can barely ride;

However, if a part to adjust, the other parts to adjust the things too much, sometimes do not have to start from scratch;

The disadvantage of the process-oriented is the poor expansibility, but also has the advantage, is fast;

If a bicycle is built with object-oriented thinking, it is to design a bicycle.

The first thing we need to do is to analyze the components of a bicycle, such as wheels, frames, chains, pedals and so on;

Then analyze and design the size and material of each part;

Then the assignment is implemented according to the part, and each part is assigned to the designated person to do it;

The end is to assemble all the finished parts, which is a bicycle;

In this way, the bicycle, maintainability and extensibility are stronger than the process-oriented thinking;

The only drawback is that the upfront investment time is a little longer;

Java object-oriented three major features;

Encapsulation: We can class, the class has methods, properties, can encapsulate a lot of functions only exposed some interfaces, to achieve modularity, build, and security;

Inheritance: Classes in Java can inherit, similar to what children can inherit from their parents, to achieve extensibility;

Polymorphic: The parent class interface in Java can point to a reference to the subclass implementation, which we'll explain in detail later.

The next three features are important, and the following chapters are detailed by example;

Java object-oriented-the basic concept of object-oriented programming

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.