Object-oriented knowledge carding

1. The core idea: Everything Is an Object (OOP Object Oriented)

2. The purpose of software that appears
(1) the language of the computer describe the real world
(2) use computers to solve real-world problems

3. The benefits of object-oriented design and development process
(1) (human) and (computer) exchanges more fluid
(2) to improve the design and development efficiency

4. Life in the definition of "tangible things" === "from the cause to the effect of process
steps: 1 static characteristics
2. Dynamic behavior
3. Classification
Step 5. Create a computer class? == "consisting of fruit due to the process
steps of: defining classes 1

 

 


2. property (static characteristics)

 

 


3. The method (dynamic behavior)

6. The step of creating a class of computers:
(1) create a class

 

 

 

 

(2) defined attributes
(rule defines attributes: only the definition of business-related property)



(3) The method defined in

 

 

 

7. The relationship between objects and classes:
class is abstract object, the object is an instance of the class

8. Syntax details:

(1) member variables, member methods
public class the Person {
// member variable
String name;
int Age;
int Health;

// member method
public void Show () {
System.out.println ( "My name is" + name + ", the age is "+ Age +" ");
}
}

(2) the object
A. Create Object
class name object name = new class name ();

B. call the object's member
reference object members: Use the following operations. ""
Property references the class: Object name attribute
referenced class method: object name the method name ()

(3) method
Syntax:
public return type method name () {
// body prepared by methods disclosed herein
}

A. No Return Value:
public void method name () {}

B. return value:
public int name Method () {
value return int type;
}

C. Method Invocation
Student class method a () method call b Student class (), directly call
the Student class method a () call Teacher class method b (), to create a class object, and then use. "" Call

System.out.println("吃。。。");
}

Guess you like

Origin www.cnblogs.com/Vvam/p/12094071.html