Construction Method:
A constructor method is a special method that cannot create a new object without constructing a method. In fact, creating an object not only calls the constructor of the actual type of the current object, but also calls the constructor of the parent class until the object class. The construction method does not have to show the call, and when the new keyword is used, the corresponding construction method is automatically called.
Rules for constructing methods;
1, the construction method can use any access modifier. including private
2. The construction method must have the same name as the class name (this is the specification, for the specification, only the first letter of the construction function is capitalized)
3, the construction method can not have a return value (the return value is not a constructor)
4. If you do not create your own constructor method in the class, the compiler automatically generates a default constructor with no parameters (as the Java Anti-compilation tool can see)
5. If you only create a constructor with parameters, the compiler does not automatically generate an argument-free construction method
6. In each constructor, if you use the overloaded construction method this () method, or the constructor method of the parent class super () method, then this and super must be placed in the first row, and two methods can only be selected, and there is no sequential problem between them.
7, in addition to the compiler auto-generated construction method, and does not explicitly call the super () method, the compiler will automatically insert a super () no parameter call
8, the abstract class has the construction method
The analysis is done.
Java-Constructor (Blind analysis)