4.1 Object-oriented
Process-oriented and object-oriented the former focus on action, the latter focus on the object (in fact, the action has been encapsulated, direct call on the line)
Class
Properties
Method () {}
} class: Just a template (description) that creates objects from a template, each with its own method. Object: is a solid entity (new in heap memory)
Face object characteristics: encapsulation, inheritance, polymorphism
An anonymous object can only be used once to create a new object at a time Eg:new class name () function: For objects that are used only once, it is convenient to use the method: Call a method or property, pass the object
Encapsulation: To avoid direct user access to data properties, to provide users with interface (the scope of the method can specify the extent of the property) indirect access using note: Private decorated properties typically require a set get method
Permission modifiers: Private can only be used in this class
Constructor: When you create a class object, the constructor is called first (if there is no initial block): Initializes the object. Note: The default constructor (null argument) does not exist when the constructor is already in effect.
This,super Keyword: This prevents the system from mistakenly thinking that a variable with the same name is assigned to the same variable this-> the current object
Javase Part 4