Java Learning Diary------Object-oriented ①

Source: Internet
Author: User


1
PackageCom.atguigu.java;2 /*3 Understanding 1: People open the door4 process oriented: people open doors5 Object-oriented:6 Person {7 Open (door) {8 door. Open ();9 }Ten } One A Door { - Open () { - } the } - */ - /*Understanding Two: People pack elephants in refrigerators - * Process oriented: 1) Open the refrigerator 2) put the elephant in. 3) Close the refrigerator door + * Object oriented: - * Person { + * Open (refrigerator) {refrigerator. Open} A * Operation (elephant) {elephant. Enter (refrigerator)} at * Close (refrigerator) {refrigerator. Close ()} - *} - * Elephant { - * - *} - * Refrigerator { in * Open () {} - *} to */ + Public classtestoop{ - the}

2. The relationship between classes and classes

1) Association relationship

such as: the relationship between Bank and customer class

class bank{  Customer Cust;  } class customer{}

2) Inheritance Relationship

3) Aggregation Relationship

Gathered

Combination

3. Object-Oriented thinking concepts

Classes and objects are the core concepts of object-oriented
A class is a description of a kind of thing, an abstract, conceptual definition.
An object is an entity that actually exists for that kind of thing, and thus is also known as an instance (instance).
Everything is an object.


class = Car design drawing. Object = a real car.
The focus of object-oriented is the design of classes.

Defining a class is actually defining a member (member variable and member method) in a class.

4.Java members of classes and classes

Property: The member variable in the corresponding class. Field = attribute = member variable.

Behavior: The member method in the Shadow class. Method = Member (methods) = function.

Java Learning Diary------Object-oriented ①

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.