Does constructor creates the object ?

classic Classic list List threaded Threaded
2 messages Options
Tiny Tiny
Reply | Threaded
Open this post in threaded view
|

Does constructor creates the object ?

I am not sure of the role of constructor in Java. Does it instantiate the object or it just do initialization.
John John
Reply | Threaded
Open this post in threaded view
|

Re: Does constructor creates the object ?

New Operator creates the object. Constructor only initializes the object elements. Default Constructor initializes the object element to their default values.