Object-oriented three features: encapsulation, inheritance, and polymorphism.
The process of Java development is to find the right library object to use, and no objects to create new objects. Find objects, create objects, use objects, and maintain relationships between objects.
Class is the description of things in real life, and objects are the real individuals of such things. Corresponding to Java programming, the description is the class structure defined by class,
An object is an entity that is built through new application heap memory. Defining a class is describing things, that is, defining properties and behaviors. Attributes and behaviors become members of the class together
(Member variables and member methods).
The difference between a member variable and a local variable:
1. Scope: the member variable acts on the whole class, the local variable acts in the function or the statement;
2. Storage location: The member variable is in heap memory because the object exists in memory and is locally in the stack memory.
Anonymous objects:
Car c=new car (); c.num=5; Equivalent to New Car (). num=5;
If new Car (). num=5; New Car (). color= "Blue"; New Car (). Run; Three objects created
Functional function problems
Main () {Car c=new car (); Show (c);} public static void Show (Car c) {c.num=3;c.color= ' black '; C.run ();}
Parameter c is a copy, but because only one object is created, C actually contains pointers, and C and parameter C in the main function are all points to the heap control object.
Java Object-oriented concepts