One.
The object is the encapsulation of the function, the object is found, and the function is found.
What is the class of contact before the object is learned? What's the relationship with the object?
Two
For Java, real-life individuals are objects. Look at the characteristics of the individual, such as car A in life, it has four wheels, is red. Car B has 5 wheels, blue. Each car has its own characteristics. In order to produce a car, you have to have something like a drawing first. We must first describe the things and then produce the individual things. If you want to build a car, first draw a drawing. What are the drawings for? A drawing is a description of a car and a car produced by a production line. The automobile is the concrete embodiment of this drawing. Drawings are descriptions of things like automobiles, which are, of course, described in Chinese. End the car description in Chinese.
Next, instead of using Chinese, would you like to be able to get the computer to handle the data that the car has? Let the computer do the math for us. Let the computer before the operation, is not to use the language of the computer to describe things, let the computer know it. Not ready to use Chinese, directly using computer language. Use the Java language to describe things.
How should the description of the Java language be completed? The Java language is all code, and Java code is placed in the class. A class is a description of the real life of the Java language.
Properties are often represented by values. Behavior is action, is function.
The above is the characteristics of the class, described.
The classes in Java are describing things in real life, describing two-point attributes and behaviors.
Class is the Java language to describe things, what about objects? (Describe things can also be described as individuals) in real life, through the description of the drawings, created the car. Now, we describe the specific things in the Java language, and then start the car and run the car as we do in life. You also want to restore the contents of your life in your computer. Manipulate things in your computer just like you do in your life. In life, make a drawing, through the drawings to produce cars. In the computer, we describe things through the language of the computer, according to the description, but also to produce the corresponding car. The difference between the two is that the real car can run in the real world, and the cars produced in the computer can only run in memory. Now it's up to the computer's description to produce a specific car object. Life is produced through the production workshop, and the computer is through the keyword new to do this thing well. Use the new keyword to produce objects of that kind. An object is a tangible individual of that kind of thing.
We're going to move everything in real life to a computer and help us with computing.
The relationship between a class and an object.
So, does the existing class have objects first? If it is through the class, new comes out of the object, that must be the first class. If it is in life, see a thing, and then describe this thing, that is the existing object, and then there are classes. In a computer, there must be class first,
A preliminary understanding of java--the sixth chapter-relationship between classes and objects