Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Constructors

 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
Are constructors part of an instance or static class?
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi dennis,
If I understand your question correctly you are asking whether
a constructor is part of the instance of a class or wheter it is
the static part of a class.
I don�t think it involves the static part of the class, because
something being static implies that there is only one, so if a
constructor is seen as belonging to the static part of a class
every instance of the class would initialise in the same way
and that�s not true.
I think it is part of the instance of a class, because it involves
the 'kick-off' of an instance of every new class by initialising
it.
Does this help?
Gian Franco
 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I figured it would be part of an instance class, but unlike instance methods (in an instance class), it cannot be inherited. Thanks for your reply Gian. I just needed a sounding board.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic