The method of construction is different from the normal method.
There are two types of methods that can be defined in a class, the method of construction and the common method, but the two methods are obviously different when they are called.
1. The constructor method is called only once when instantiating a new object
2. The normal method is called multiple times by the object method after the instantiation of the object is generated.
If void is used on a construction method, its definition is exactly the same as the normal method, and the program compiles by defining the structure to parse it. Therefore, there can be no return value in the case.
In addition, the most important difference between a constructor method and a normal method in a class is that the constructor is called directly when using the keyword new, which is the operation performed together with the object creation.
What is the difference between a construction method and a common method in Java?