permaculture playing cards*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Does Constructor create Object???" Watch "Does Constructor create Object???" New topic
Author

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....


eg



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
Bartender

Joined: May 31, 2011
Posts: 1776
Constructors help in object creation - and they are always called during object creation. Read Oracle tutorials - Constructors
 
 
subject: Does Constructor create Object???