what is the purpose of a constructor in a java class?
Home
/
Computer Science
/
what is the purpose of a constructor in a java class?
what is the purpose of a constructor in a java class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
Explanation:
The purpose of constructor is to initialize 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.
Hope it helps you.