I have checked many websites but did not get the right answer. what is the meaning of constructor in java?
closed as off-topic by Yuval Filmus, Evil, dkaeae, chi, David Richerby May 28 at 15:47
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions about software development or programming tools are off-topic here, but can be asked on Stack Overflow." – Yuval Filmus, Evil, dkaeae, chi, David Richerby
Constructors are used to initialize the object’s state. Like methods of, a constructor also contains collection of statements(i.e. instructions) that are executed at time of Object creation.A constructor is invoked at the time of object or instance creation.