Constructor And Function in Java


Constructor Function/Method
It has the same name as that of the class name. It has a name different from the class name.
It doesn’t need to be called from the main class (i.e. it is invoked implicitly). It is called from the main class.(i.e. it is invoked explicitly)
It does not return any value. It may or may not return a value.
They are usually public. It may be public or private.