Construction method
1 . Syntax requirements:
(1) The method name must be consistent with the class name.
(2) There is no return value type.
(3) The construction method is allowed to be overloaded.
(4) The construction method is not allowed to be called manually when creating an object.
2 .Function:
(1) A construction method can be used to create multiple objects.
(2) Attributes can be assigned by means of a parameterized construction method.
3 .Application
Example:
