I. Introduction to objects and introduction to objects

Source: Internet
Author: User
Tags export class

I. Introduction to objects and introduction to objects

I. Five Basic Features of Java:

1. All things are objects

2. The program is a collection of objects. They send messages to each other to tell each other what to do.

3. Each object has its own storage composed of other objects

4. Each object has its type

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

 

2. Each object can only satisfy certain requests. These requests are defined by the interface of the object.

 

3. Each object provides services and regards the object as a service provider, which helps improve the cohesion of the object.

 

Iv. Access Control

1. Make client programmers unable to touch what they should not touch

2. Allows database designers to change their internal working methods without worrying about affecting users.

3. Four permissions: public private protected default

 

5. code reuse is the biggest advantage of object-oriented programming, and reference objects are the simplest reuse.

 

6. types not only describe the constraints acting on an object set, but also the relationship with other types.

There are two ways to make the base class and subclass different.

1. Add a new method directly

2. overwrite the original method

 

7. polymorphism. The process of viewing the export class as its base class is called upward Transformation (P10)

 

8. Java has a single inheritance structure, and all classes inherit from object classes.

 

9. The OOP language has its own set of containers, such as list, map, set, and components such as queues, trees, and stacks.

 

10. Object creation and lifecycle

1. By placing the object in the stack or static area

2. dynamically create objects in the heap memory pool

Java adopts the second method, that is, using new to create objects.

 

Related Article

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.