diffrence between a constructor and method in java programming
Answers
Answered by
1
Following are the difference between constructor and method.
Constructor is used to initialize an object whereas method is used to exhibits functionality of an object.
Constructors are invoked implicitly whereas methods are invoked explicitly.
Constructor does not return any value where the method may/may not return a value.
In case constructor is not present, a default constructor is provided by java compiler. In the case of a method, no default method is provided.
Constructor should be of the same name as that of class. Method name should not be of the same name as that of class.
kakkerisunil:
welcome
Answered by
3
here is the difference:
please mark it as brainliest answer
and please follow me
Attachments:
Similar questions