File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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
I agree. Here's the link:
subject: Does Constructor create Object???
It's not a secret anymore!