Knowledge Summary-JAVA object-oriented

Source: Internet
Author: User

I. learning objective a) Class and object B) constructor c) object creation and use d) Information encapsulation and hiding e) package statement/import Statement 2. Understanding object-oriented concepts a) process-oriented I. defines the size, position, color, background, and other properties of a window in a struct. The function of a window operation has nothing to do with the definition of the window itself, such as HideWindow, MoveWindow, MinimizeWindow, all these functions need to accept a window parameter that represents the operation to be performed. It is a relation between the predicate and the object. B) Object-oriented I. when defining a window, in addition to specifying the attributes specified in the process orientation, such as the size, position, color, and background, you must specify the actions that the window may have, such as hiding and moving, minimize. When these functions are called, they are all used in the syntax format of a window to be hidden and a window to be moved. This is a relationship between the subject and the predicate. C) three features of object-oriented I. encapsulation ii. inheritance (Inheritance) iii. polymorphism d) Object-oriented ideology overview I. the object-oriented programming ideology tries to make the description of things in computer languages as consistent as possible with that in the real world. Ii. class and object are the core concepts of object-oriented methods. A class is an abstract and conceptual definition of a class of things. An object is an entity of a class of things that actually exists. Therefore, it is also called an instance ). E) class definition I. declaration class 1. syntax format: [<modifier>] class <class Name> {[<attribute declaration>] [<constructor declaration>] [<method declaration>]} 2. note: modifier public: class can be accessed at will. 3. the class body should be included in {} ii. declare attribute 1. syntax format: [<modifier>] type <attribute name> [= initial value]; 2. note: modifier private: This attribute can only be accessed by methods of this class. Public: This attribute can be accessed by methods other than this class. Type: any basic type, such as int, boolean, or any class. Iii. declaration method 1. syntax format: <modifier> <return type> <Method Name> ([<parameter table>]) {[<Statement>] www.2cto.com} 2. description: modifier: public, private, protected, etc. Return type: return Statement. No return value: void. Iv. Class Access Mechanism: 1. Access Mechanism in a class: Methods in the class can directly invoke member variables in the class. (With one exception) 2. Access Mechanism in different classes: first create an object for the category class, and then use the Members defined in the category class of the object.

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.