This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abtract class object is not created

 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if we extends the abstract class and provide the implementation for the methods which are declared in abstract class.And then we create the object of that subclass. then at that time default constructor of that subclass is called and we pass 'super' in the constructor of that subclass then it call the constructor of super class? is there is any object create of abstract class?
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pramod deodeore:
if we extends the abstract class and provide the implementation for the methods which are declared in abstract class.And then we create the object of that subclass. then at that time default constructor of that subclass is called and we pass 'super' in the constructor of that subclass then it call the constructor of super class? is there is any object create of abstract class?


What you explain is correct, but there is no object created for abstract class. Constructors are made to initialize the instance variable, though of that base abstract class too..
 
Campbell Ritchie
Sheriff
Posts: 48441
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way I think of it, which might not be accurate, is that every object has a "part" which is inherited from its superclass. So every object has a toString() method inherited from java.lang.Object.
The super() call (explicit or implicit) sets up that "part."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic