What is the purpose of a constructor in Java?
A constructor is used to define methods that allow the program to run.
That's not quite correct. Constructors are for initializing objects, not defining methods.
Can you explain how an object is created in Java when a constructor is invoked?