In this blog, we can see the difference between method and constructor. If you want to know in details about method and constructor please refer below links.
Method vs Constructor
Constructor | Method |
---|---|
The constructor name should be same as class name | The method name may or may not be same as class name |
Should not have the return type | Should have the return type |
Can overload in the same class, And cannot override in subclass. | Can overload in the same class and override in subclass |
Used to create an object by using the new keyword. | Used to perform some functionality or behavior. |
Should not be static and final | Can be static and final |
You can call the parent class constructor using super() from child class | You can call the parent class method using their name from child class |