Difference between constructor and a method

The important difference between constructors and methods are:

Constructors create and initialize objects that don't exist yet, while methods perform operations on objects that already exist.

Constructors can't be called directly; they are called implicitly when the new keyword creates an object. Methods can be called directly on an object that has already been created with new keyword.

Constructors must be named with the same name as the class name. They can't return anything, even void (the object itself is the implicit return). Methods must be declared to return something, although it can be void.
Posted on by