Object-oriented Java (previously written log migration

Source: Internet
Author: User

1) Object-oriented features

1. Abstract: (from the Java side of the abstract most people still treat it as a feature in Java)

Abstraction is about ignoring aspects of a topic that are not related to the current goal, so that you can more fully focus on the aspects that are relevant to the current goal. Abstract includes two aspects, one is the process abstraction, the other is the data abstraction.


2. Inheritance:
Inheritance is a hierarchical model of a junction class and allows and encourages the reuse of classes, which provides a way to articulate commonalities. Derived classes can inherit methods and instance variables from their base classes, and classes can modify or add new methods to make them more suitable for special needs.


3. Package:
Encapsulation is the process and data is surrounded, access to data only through the defined interface. Object-oriented computing begins with this basic concept that the real world can be portrayed as a series of fully autonomous, encapsulated objects that access other objects through a protected interface.


4. Polymorphism:
Polymorphism refers to allowing objects of different classes to respond to the same message. Polymorphism consists of parameterized polymorphism and inclusion polymorphism.

The explanation in the book is:

Encapsulation: It is to abstract the nature of things by defining classes and adding access control to the properties and methods of classes.

The so-called inheritance: is code reuse.

The so-called polymorphic: the interface and implementation are separated from another angle, that is, "what" and "how" two concepts separate.

2) What is OOP? What is a class? Compare the relationships between classes and object instances.

OOP is an abbreviation for object_oriented programming (object-oriented programming). This is mainly to distinguish from the previous process-oriented programming! refers to the organization and construction of the system using the object's point of view, which synthesizes functional abstraction and data abstraction, which reduces the coupling between data and the probability of error in code. The use of object-oriented programming technology can make the software developers according to the real world people think about the pattern of writing code, you can let the software developers better use the code to directly express the real objects exist, the problem space directly mapped to the solution space!

Class: The class, in object-oriented programming design, specifically uses "classes" to represent user-defined abstract data types (user_defined abstract type). It abstracts multiple objects with the same state, operation, and access mechanism. Class has three main characteristics of inheritance, data hiding, and polymorphism. These three attributes of the class can be used to better represent things in the real world. A class is an abstraction of the commonality of an object instance of the same class, and an object is an instantiation of the class. Objects are often used as computer simulation thinking, representing the real world of abstraction, an object like a software module, can provide users with a series of services---can change the state of the object, testing, delivery of messages and so on. class defines the implementation details or data structures of an object. The class is static, the object is dynamic, and the object can be thought of as a running class. Class is responsible for generating objects and can be used as a factory for production objects (object factory)

There is another concept: all things are objects.

Object-oriented Java (previously written log migration

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.