1. Introduction of object-oriented thinking
When there are multiple arrays that need to be traversed, we can encapsulate the traversed code into a method, and call the appropriate method to improve the reusability of the code when it needs to be traversed. Continuing to increase demand on the basis of an array traversal, such as getting the most value, reverse the value, and so on, it is also necessary to encapsulate these functions into appropriate methods. The continuation of encapsulation will find that there are more and more methods, so I would like to be able to continue to encapsulate these methods? We know that classes can be used to encapsulate multiple methods, so in the future, when we do array operations, we do not have to find a specific method, first find the class, and then use the methods in this class.
2. Overview of process-oriented thinking
Steps to complete a requirement: The first is to figure out what we're going to do, then analyze what to do, and finally we'll use the code to show it. Step by step to achieve, and each step of the specific need for us to implement and operate. These steps call and collaborate with each other to complete our needs.
In each of the above specific steps, we are participants, and need to face specific steps and processes, which is the most direct embodiment of the process of facing.
So what is process-oriented development? For the development of chopping into, in fact, is facing the specific amount of each step and process, each step and process is completed, and then by these functional methods call each other to complete the requirements.
Process-oriented representative language: C language.
3. Overview of object-oriented thinking
When the requirements are single, or simple, we take steps to operate without problems, and the efficiency is very high. But with the change in demand, the increase in functionality, the discovery of the need to face each step is very troublesome, then began to think, can these steps and functions of packaging, packaging, according to different functions, different packages, features similar package together. So the structure is much clearer. When you use it, find the corresponding class. This is the idea of object-oriented.
Object-oriented is a process-oriented programming idea.
Object-oriented is a kind of thought that is more in line with our thought habits, which can simplify complex things and turn us from performers to conductors.
4. Object-oriented development, design, features
Object-oriented development: it is constantly creating objects, using objects, directing objects to do things.
Object-oriented design: In fact, the relationship between managing and maintaining objects.
Object-oriented features: encapsulation, inheritance, and polymorphism.
5. Class-To-object relationships
We learn programming language, is to simulate the real world things, to achieve information. For example: to the supermarket to buy things billing system, to the bank to transact business system.
How do we express a real thing? Attribute: Is the descriptive information of the thing, the behavior: is what the thing can do.
The basic unit of the Java language is tired, so we should put things in a class to reflect.
Class: is a set of related properties and behaviors.
Object: Is the concrete embodiment of this kind of thing.
For example: Class--and student objects--monitor
6. Definition of class
Things in the real world
Properties: Man's height, weight and so on.
Behavior: People can learn, eat and so on.
The same is true in Java for describing things in class.
Member Variable: is the property of a thing
Member method: Is the act of a thing
Defining a class is actually the member (member variable and member method) that defines the class.
6. Student Class
public class student{String name; int age; public void Say () {System.out.println ("Student Speaking"); }}public class studenttest{public static void Main (string[] args) {//Instantiate student class Student Stu = new Student (); Copy stu.name = "hehe" to the property of the class; Stu.age = 1; Call Method Stu.say (); }}
This article is from the "11831428" blog, please be sure to keep this source http://11841428.blog.51cto.com/11831428/1855906
Object-oriented Java