What is use of constructor in java?
Answers
Answered by
3
The purpose of constructor is toinitialize the object of a class while the purpose of a method is to perform a task by executing java code. Constructors cannot be abstract, final,static and synchronised while methods can be. Constructors do not have return types while methods do.
Similar questions