Object-oriented ideological foundation

OO object-oriented object oriented
object-oriented: what is this thing I have done, participated in the completion of what is the object.
Object: Object classes can be defined in the data base is not object-oriented object can not be used if the basic data type definition is an object oriented object.
Properties: refers to the subject who has any value data, each object class has its own attributes and behavior characteristics = attribute
behavior: what an object can do, or we want to do with these objects. Method behavior =
Process-oriented: to do something specific process. To solve problems.
Everything object, the object due to concerns arising.
Class is an abstract object, the object is an instance of the class.
Object classes and relations
1: abstract class is a group of objects with the same properties and behavior.
2: In the software system, we use the class to simulate real-life entities.
3: is a template class can not be directly used, and the object is in particular pure, it has been an object instance of the class referred to.
4: produced by the action of an object class is called "instantiated"
Operating objects (attributes and behaviors)
. "" Object plus operator
".": This symbol is interpreted as "the"
Student STU = new new Student ();
stu.age (Age Age) understood as: the age of the students

In the object-oriented, static is a special case, the method is not static 90 percent of the
java-based is to avoid the object-oriented concept. From now on, I do not know to learn to write before static.
Writing java class
java class in a class declaration, Java source code file can contain only one public class, the filename must be the same class public class name, the file extension ".java"
attribute is the value of the class body of data. In the form of property that variables and constants
Variable properties: declaration syntax uses the syntax of variables, just one more than the average variable access modifiers before
, in effect, objects of this class will have this property, but all objects can have different values.
Constant Property: declaration syntax uses a syntax constants, but with an access modifier final data type constant name (all caps) than the average constant before.
In effect the objects of this class will have attributes, but values are the same and can not be changed.
Object-oriented class in complex data types than the basic data types, properties and behavior of his composition, may be a plurality of attributes, and each have their own data types.
Essential definition is to define a class of data types - Complex reference type
Object-oriented data type is a reference type of data, the programmer is defined as a column: = new new stu Student Student ();
Student stu --- generating only a 4-byte variable space
stu variable holds true upcoming point application student objects, known as the "target namespace"
new new student () - this can produce a student objects
to the object with a whole space for each property, the size of this space is determined by the sum of the properties of the object body size --student the size of the decision.

The new type of object primitive data initial value of 0, a reference value of the initial data type unll.
(: Garbage collection gc) to complete by the java garbage collection to destroy objects when
it has its own algorithm rule, programmers can not control through code.
One day in a number of basic rules of the garbage collection algorithm, it initiated a voluntary recall does not refer to the object pointed
So
1: If you want a program to be recycled, we can take the initiative to put his point of reference assigned to null.
NullPointerException: null pointer exception. = null STU2; int X = stu2.age;
System.out.println (X); error.
2: If the object reference variables (object name space) is a local variable, then when the end of the module to which it belongs, the life cycle of this variable on coming to an end, variables disappeared, he was referring to the object there is no reference point to, It will be recycled.
3: Programmer Only one code can be generated at the code level and the intersection between garbage collection, when this code System.gc ();
the role of this code instead of calling garbage collection, not as a call garbage collection, but the garbage collector do not charge admission is his own decision.
4: If an object only once, you can not give that object from the variable name, new out can be used directly. In the absence of references used up, it will be recycled.
.
There are three access modifier keyword, four cases.
Now we have 2
public (public) modification of the properties and methods that can be used anywhere in
private (proprietary) modified properties and methods, you can use this class
Java based official specification variable properties, because this definition is private, and then provide get / set methods, so that the external operation and assignment values
get method is called: accessor
set method is called: Modifier
2 format by and the name, there are standards
When a global variable (attribute) the same name and local variables, local variables are used by default.
In this case, refers specifically to the global variables (current object) in front of a global variable needs + "this." Operation, the equivalent of self-introduction, clear the current object
The benefits of this
1: Improving development efficiency
2:
 
 
 
oop object-oriented programming Programming
OOA OOA the Analysis
OOD OOD design

Starting with the object-oriented process-oriented ----

Guess you like

Origin www.cnblogs.com/caohua95/p/11593408.html