[Learning] Java classes, objects, instance - class is an abstract object, the object is an instance of the class

What is the relationship class, object instance is that if you can not understand what is good what is the object of the class can not speak clearly,

Class: something with another thing similarities, such as huskies and Teddy, we find that they have some similar characteristics and behavior, biology, they are "dog", what would the dog do? They will be called, has four legs and so on, we have the same properties and behavior of this thing called class, is what we often say "They are a class of things." We know programming languages and data in this type of thing, then the "class" is a data type, reference type defined by the user. And in the class, properties and methods used to describe features of the object (such as dogs must have nose) and behavior (such as a dog wagging its tail will). There is also a feature of the class is that it is abstract, there is no such thing called a specific "dog", the answer is no, characteristics and behavior of all dogs called dogs, so when the abstract class.

Object: a specific thing does not have universal is the object, for example, you have a dog called HaHa, HaHa is the object, it is concrete, in the real world, we see everything is an object.

Classes and objects have to do with it? : Using the example just our dog's point of view, HaHa is a dog, that is to say Haha is a concrete manifestation of the dog, that is not to say, HaHa is a concrete example of the dog, when the dog was asked what is the time you pointed HaHa said, this is a dog, we called HaHa is a concrete example of the dog.

Now we can be very good area classification, object instance of the class is a generic term of things with the same properties and behavior of an object is a concrete example of the class, that class is an abstract object, the object is an instance of the class

Guess you like

Origin www.cnblogs.com/marlanchen/p/11563929.html