This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Does Constructor create Object??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Does Constructor create Object???" Watch "Does Constructor create Object???" New topic

Does Constructor create Object???

deepak carter
Ranch Hand

Joined: Feb 19, 2011
Posts: 165
Hi All,

Here is small piece of code

Now if i will create a object of it

The statement new Test() will cause a deafult constructor of the above class to be invoked...

Now what happens in case of parameterised contructor is provided in the class....


If i create a object of this above class

Test1 test1=new Test1(2);

will this will also help in object creation...

This question has been asked 2-3 times and i am not getting any clear cut answer to the questionOES CONSTRUCTOR CREATE OBJECT OR DOES IT HELP IN THAT???

Thanks in advance...
John Jai

Joined: May 31, 2011
Posts: 1776
Constructors help in object creation - and they are always called during object creation. Read Oracle tutorials - Constructors
Have you checked out Aspose?
subject: Does Constructor create Object???
It's not a secret anymore!