Java Programming Idea (thinking in Java) reading notes (for self learning only, continuous updating) __ algorithm

Source: Internet
Author: User

Object-oriented programming (OOP)

Describe the problem according to the problem, rather than the computer that runs the solution. Each object has a state, an action, and the user can ask the object to perform these actions. Object-oriented five basic features:

1. All things are objects;

2. A program is a collection of objects that tell each other what to do by sending messages;

3. Each object has its own storage consisting of other objects, that is, you can create new types of objects by creating packages that contain existing objects. (privately considered as an inheritance mechanism);

4. Each object has its own type;

5. All objects of a particular type can receive the same message. Classes and Objects

Each object belongs to a particular class that defines the attributes and behavior.

A class is actually a data type, for example, all floating-point numbers have the same set of attributes and behaviors.

Object O=newobject ();

The object is created in this way by defining a reference (O) for the object, and then calling the new method to create a fresh object of that type.

Imagine an object as a "service provider": The program itself will provide services to the user, and it will do so by invoking the services provided by other objects. Seeing an object as a service provider helps improve the cohesion of the object. Each object should be able to perform some tasks well, but not try to do more.

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.