Constructor is special type of method whose name is same as class name and no return type and even void .we can’t call the constructor explicitly.
Method may or may not have same class name but constructor must be same name as class name.
Now question is why constructor name is same as class name?
new is an operator whose work is to allocate memory and the idea gave it to by constructor. And if constructor name is same then, new will think goes to this class and allocate this amount of memory for the class instance variable. if constructor name is not same as class name then it got confuse for which class it has to allocate the memory. So if there is not any standard maintain then it will be problem now that all you know that at compile time JVM automatically add default constructor whether we write or not in class so compiler will also confuse what name should I gave to this constructor so we have to follow the standard.so that’s why constructor name and class name must be same.
constructor has implicit return type and type is as class type. Which is implicitly added by the compiler.and when we create a Object then and the reference Id of that object is in already in constructor and the id is in form variable this.
You will get an error that method void is having return type and we are storing in int c so it’s not possible.
When we create an object constructor call automatically by new And the reference id is hold in variable a so how because constructor return so that we can able to hold the reference variable.
Note:method which return an object when it’s called then it’s called factory method.
And any method return type can be class type primitive type user define type.