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

  • Home
  • SEARCH
  • 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 6536203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:27:51+00:00 2026-05-25T10:27:51+00:00

I have read somewhere that we cannot initialize an interface, for example: interface MyInterface{};

  • 0

I have read somewhere that we cannot initialize an interface, for example:

interface MyInterface{};

And the following code is definitely illegal:

MyInterface m = new MyInterface();

And as I remember the text I have read said: that because the new keyword is used to allocate memory for class members; so in case of interface, we only have abstract functions, so there is nothing to be allocated in an interface; therefore, initializing an interface is prohibited.

OK, that makes sense to me.

But in case of abstract class, we are allowed to declare and define abstract functions, non-abstract function, as well as normal variables;so why we also are not allowed to initialize an abstract class? And because of that, I was wondering when and how variables in an abstract class, if any, are allocated memory?

  • 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-05-25T10:27:51+00:00Added an answer on May 25, 2026 at 10:27 am

    No object is ever an instance of “just” an abstract class – it’s always an instance of a concrete class. Otherwise you could call the abstract methods… and there’d be no implementation to be called.

    The variables in an abstract class are allocated the same way as the variables of any other class which happens to be a superclass of the actual class being initialized – they live “with” the variables from the other classes in the hierarchy, basically.

    EDIT: To clarify, this is a conceptual limitation as much as an implementation one. An abstract class usually contains abstract methods, which is the reason for making it abstract. The point of abstract methods is to allow the caller to have compile-time checking that the method will be there, even though the abstract class doesn’t provide the implementation. The VM ensures that there is an implementation by preventing instantiation of “just” abstract classes.

    Now abstract classes can also be used to prevent instantiation even if there aren’t any abstract methods – basically the fundamental point of an abstract class is that it’s one which can’t be directly instantiated; only concrete subclasses can be instantiated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to XML serialization and I have read that private variables cannot
I have read somewhere that Silverlight is subset of WPF , then why triggers
I think I read somewhere that some modules only have object oriented interfaces (
I know about mysql_num_rows ( resource $result ) but I have read somewhere that
I have read somewhere that CreateGraphics() will do this steps for us : BeginPaint
I have read somewhere that I better use multi-part types on receive and send
I thought I have read somewhere that the accuracy of Android's GPS is about
I read somewhere the view ids used by JSF framework have a happy side
I have read a lot that LISP can redefine syntax on the fly, presumably
I have read that using database keys in a URL is a bad thing

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.