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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:06:04+00:00 2026-06-07T17:06:04+00:00

In java if you have an object that requires a generic to extends a

  • 0

In java if you have an object that requires a generic to extends a particular class, but you want to implement it with an extension of that class is there any way to let java know that you are not actually breaking your own rules? Example code below in the assumption that that made no sense.

public interface WantedInterface extends StaticInterface<WantedObject>

public class WantedObject extends OlderObject

public class OlderObject extends UsefulObject

public interface StaticInterface<T extends UsefulObject>

So my question is essentially, is there any way for me to tell my StaticInterface that my WantedObject does in fact extend my UsefulObject even though it is not direct? I would really prefer not to have to rewrite my WantedObject as a pure extension of a UsefulObject just because the OlderObject contains a lot of useful code and I am writing to a database where the sequence I am using would want to have knowledge of the current state of OlderObject. I realized in writing this that I could just have WantedInterface directly extend the interface for OlderObject, but I want to know if there is a way to avoid this.

EDIT:
Okay so, in a very weird twist of things I was able to fix the problem by changing the extension of WantedObject to UsefulObject, and then changing it back as it was. Perhaps the problem was just some temporary IDE thing? I’m using eclipse, does it have problems with this by chance?

  • 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-07T17:06:06+00:00Added an answer on June 7, 2026 at 5:06 pm

    A extends B is transitive, which is a fancy way of saying that if A extends B and B extends C, then A extends C as well. For example, the compiler will have no problems with the following code:

    UsefulObject uo = new WantedObject();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java I have an object that looks like this : class MyDoc {
I have a Java class that takes a generic type parameter and a class
I have a Java Properties object that I load from an in-memory String ,
I have a hibernate object that gets detached and transferred to a thick java
I have a java.sql.ResultSet object containg data from a query that was run. How
Suppose I have a Java method that returns a HashMap object. Because a LinkedHashMap
I have a Graphics object of JPanel and that is working fine: import java.awt.Color;
I have noticed in Java that you can have a function with object... as
I have a C program that stores some object in java store using JNI.
I have Java Map (out of Strings and Ints) objects that I want to

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.