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 8992413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:56:55+00:00 2026-06-15T22:56:55+00:00

Assume I obtained a Class object by loading a class dynamically using Class.forName(Foo) .

  • 0

Assume I obtained a Class object by loading a class dynamically using Class.forName("Foo"). Foo is abstract in this case, so I cannot call newInstance() on it. (How) is it possible to declare a concrete subclass of Foo?

  • 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-15T22:56:56+00:00Added an answer on June 15, 2026 at 10:56 pm

    You declare it as not abstract e.g.

    class Bar extends Foo {
        // implement methods are required.
    }
    

    In short, just because you loaded the class dynamically doesn’t mean the rules change 😉

    Foo is not available at compile-time

    If you don’t have Foo available at compile time, you still need to have a sub-class of this class which is concrete to create it. To do this you have two options.

    • find a concrete class and create that. You can use the Reflections library to find such a class.
    • generate code and compile it using the Compiler API, or BeanShell.
    • generate byte code for the subclass using ObjectWeb’s ASM.

    I suspect the first option is what you need because unless there is a subclass provided for you, you still need to generate the code for the abstract methods.

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

Sidebar

Related Questions

Let's assume I have two gmdistibution models that i obtained using modeldata1=gmdistribution.fit(data1,1); modeldata2=gmdistribution.fit(data2,1); Now
Assume a legacy class and method structure like below public class Foo { public
A typical code fragment obtained from the YouTube embed feature looks like this: <object
Assume I have an enumerable object enum and now I want to get the
Assume this code works: left '*' left '+' expr: expr '+' expr | expr
Assume you have 3 given tasks. You can run them either using process or
Assume I've declared a function (or class, doesn't matter) in a header file, which
Assume that we want to intercept the exit system call and print a message
When using the OAuth protocol, you need a secret string obtained from the service
Assume Hibernate for the ORM. I'm not sure how to ask this. I want

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.