Java programming ideology 01-Introduction to objects (theoretical understanding is also important)

Source: Internet
Author: User
Tags export class
1. abstract process

Everything is an object.

ProgramIs a collection of objects. They send messages to tell each other what to do.

Each object has its own storage composed of other objects.

Each object has its type.

All objects of a specific type can receive the same message.

2. Each object has an Interface

A class is a data type.

One of the challenges of object-oriented programming is to create a one-to-one ing between the elements in the Problem Space and the objects in the solution space.

3. Each object provides services.

When you try to understand a program, one of the best ways is to think of the object as a "service provider"

There is a benefit to this understanding: it provides the cohesion of objects. (High cohesion is one of the basic quality requirements of software design)

4. Specific implementation of hiding

Class Creator: the target is the build class.

Client programmers: collect various classes for Rapid Application Development.

Why is access control required?

First, it is to make client programmers unable to touch what they should not touch. These things are necessary for internal operations, but not part of the interface for users to solve specific problems.

Second, allow the library designer to change the internal method of the class without worrying about the impact on the client programmers who use the class interface.

Set the internal boundary with three keywords: Public Private protected.

Java also has the package access permission. Class can access members of other classes in the same package.

5. Reuse specific implementation

The existing classes form a new class called a combination. If a combination occurs dynamically, it is usually called aggregation.

6. Inheritance

Source class: base class, superclass, parent class

Copy: Export class, inheritance class, subclass.

Think of the export class as its base class as upward transformation; think of the base class as its export class as downward transformation;

Java uses the dynamic memory allocation method.

Read Postscript:

As I am looking for an internship next semester, I plan to read both C and Java from the beginning and lay the foundation to build a higher floor.

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.