what is the difference between method and a constructor
Constructor is a method which is called when a new instance of the class is created.
A constructor is a special method, its implicitly called when a class is initialized but you can override the default constructor by creating your own that initializes your variables or objects, and it must be called the same name as your class's name.
Construtor is a method which has the name as its class name and has no explicit return type.
constructor must have same name as class name constructor has no return type constructor can be default or user defined default constructor is invoked automatically when class is initialized