Members of the class:
member variables and member functions.
member functions: Constructors and normal functions.
constructor function:
Function: Initialize an object automatically
Features: 1. Method names and class names are consistent
2. No return value
Ask:
1. Can we define several constructors?
We can define multiple constructors as long as we overload them. If we don't get overloaded, our system will automatically give us a constructor without parameters.
class customer{private string A; Private int b; = ab;} Customer (String ab,int== BC;}}
2. With the same object, how many times can our constructors be dropped?
The same object, we can only invoke it once, and call it once when we are new.
Is there a destructor in 3.Java?
There is no special destructor in Java, and when an object is not referenced to it for a long time and is not used, the garbage collection mechanism automatically dies.
4.this references
This is followed by a member name, which is the equivalent of a special declaration that the member is a member of a class, not a local variable
Inference: A member of any class, when used in a class, can add this. To modify, as long as there is no ambiguity, can also be omitted.
————————————————————————————————————————————————
Java-like and objects