Java / Constructor
Difference between constructor and method in Java.
|Java Constructor.||Java Method.|
|Constructor initialize the state of an object.||Method exhibits the behavior of an object.|
|Constructor must not have return type.||Method must have return type.|
|Constructor is invoked implicitly.||Method is invoked explicitly.|
|In case of default constructor, the java compiler provides a default constructor if you don't have any constructor.||Method is not provided by compiler in any case.|
|Constructor name must be same as the class name.||Method name may or may not be same as class name.|
More Related questions...