Chapter One-Introduction to Objects

Source: Internet
Author: User
Tags inheritance

1. Five basic features of object-oriented languages

A) objects of all Things

b) program is a collection of objects

c) Each object has its own storage composed of other objects

d) Each object has its type

e) A particular type of object can accept the same information


2. Hide specific implementations

Objective:

If the program developers are divided into two categories according to roles, one is the creator of the class, and the other is the client programmer, then hiding the concrete implementation means that the class creation can arbitrarily change the concrete implementation of the class without worrying about the use of other people, and that the hidden parts are generally vulnerable parts. This can reduce the probability of a bug appearing.

Method:

Separation and protection of interfaces and implementations.


3. Combination

and any number of other objects of any type are grouped together in any way that can implement the functionality of a new class, called a combination, and if it is dynamic, we become aggregates and are often treated as "has a" relationships. As in the UML diagram below:


4. Inheritance

There's nothing to say.

Because the combination is more flexible than inheritance, the combination is preferred when creating a new class.


5. Containers

At any time, you can expand yourself to accommodate the things that need to be placed in them. In Java, such as list, map, set, and so on.


6.java is the design pattern that implements a single root structure, that is, all classes are generated according to a tree structure, and the root is an object class. This allows all objects of the class to have a common interface, which ultimately belongs to the same class.


7. Creation and life cycle of objects

Java completely uses dynamic memory storage, using the heap to dynamically create objects in the memory pool. More flexible. (using stacks compared to C + +)


8. Concurrent Programming

Brief introduction, detailed explanation behind


9..java compared to C + +: Each has its advantages, acting in different fields, Java powerful type check and error control system is unmatched, Java running speed is not comparable with C + +, even if it has been

A big change.

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.