Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does Constructor create Object???

 
deepak carter
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Constructors help in object creation - and they are always called during object creation. Read Oracle tutorials - Constructors
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic