My java--object-oriented programming

Source: Internet
Author: User

Object-oriented programming is to encapsulate the operation of data and data into an indivisible whole, and abstract objects with the same characteristics into a new type of data-class. The entire system is run through message passing between objects. Provides an effective way to reuse code through the inheritance of object classes.

Difference:

In the object-oriented programming method, its program structure is a collection of classes and various types of structures that are associated with inheritance relationships. There is a main program that defines objects in the main program and prescribes the law of passing messages between them.

Object: The core of object-oriented technology. All object-oriented programs are composed of objects that are first self-governing, self-satisfying (he can manage himself through his own defined actions), and they can communicate, coordinate and cooperate with each other, thus accomplishing the whole program's characters and functions together.

Class: Is the collection and abstraction of the same object. A class is an abstract data type, which is an abstraction of all objects with a certain commonality, whereas an object belonging to a class is called an instance of the class, and is the result of a class instantiation.

The state and behavior of the object:

Objects have state and behavior.

The state of an object, also known as the static property of an object, mainly refers to the various information contained within the object, that is, variables. Each object individual has its own proprietary internal variables that indicate the state in which the object is located. When an object undergoes a state change in a certain operation and behavior, it concretely reflects the change of the content of the variable. By examining the contents of the object's property variables, you can see what state the object is currently in.

Behavior is also called the operation of the object it mainly describes the dynamic properties of the object, the action is to set or change the state of the object. An object's operations are generally based on variables inside the object and attempting to change those variables (and change the state of the object)

Difference:

The state of an object is represented inside the computer by a variable, and the behavior of the object is represented inside the computer by means of a method.

(methods are similar to procedures-oriented functions.) The behavior or operation of an object is defined inside its method. )

My java--object-oriented programming

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.