Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:53:04+00:00 2026-06-17T16:53:04+00:00

When we create a Subclass object which extends an abstract class, the abstract class

  • 0

When we create a Subclass object which extends an abstract class, the abstract class constructor also runs . But we know we cannot create objects of an abstract class. Hence does it mean that even if a constructor completes running without any exception, there is no guarantee whether an object is created?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:53:05+00:00Added an answer on June 17, 2026 at 4:53 pm

    Hence does it mean that even if a constructor completes running
    without any exception, there is no guarantee whether an object is
    created?

    Simply speaking, a constructor does not create an object. It just initializes the state of the object. It’s the new operator which creates the object. Now, let’s understand this in little detail.

    When you create an object using statement like this:

    new MyClass();
    

    The object is first created by the new operator. Just before a reference to the newly created object is returned as the result, the indicated constructor is processed to initialize the new object.


    Now consider the case of Abstract class and it’s concrete SubClass, when you do like this:

    AbstractClass obj = new ConcreteClass();
    

    new operator creates an object of ConcreteClass, and invokes its constructor to initialize the state of the created object. In this process, the constructor of the abstract class is also called from the ConcreteClass constructor, to initialize the state of the object in the abstract class.

    So, basically the object of AbstractClass is not created. It’s just that it’s constructor is invoked to initialize the state of the object.

    Lessons Learnt:

    • The object is created by new operator, and not by the invocation of the constructor itself. So, the object is already created before any constructor is invoked.

    • Constructor is just used to initialize the state of the object created. It does not create an object itself.

    • An object state can also be contained in an abstract super class.

    • So, the purpose of invocation of Abstract class constructor, is only to initialize the object completely, and no object is created in process.

    See:

    • Creation of new Class Instance – JLS-Section#12.5
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need create a variable with parent subclass. Example: Parent Class <?php class parentClass
In JavaScript, every function's prototype object has a non-enumerable property constructor which points to
I have a base class called Geometry from which there exists a subclass Sphere
I'm having trouble with my code. I'm trying to create a subclass which inherits
I need to create a new instance of an NSManagedObject subclass, which I then
how can i create an instance for NSmanagedObject Class which i am created using
I have a UIView subclass which seeks to create a rounded rect overlay on
I have a class called ToolbarView which is a subclass of UIView and basically
I'm aiming to create a set of objects, each of which has a unique
C++ How to create subclass in class with array Hi guys, i still learning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.