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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:10:51+00:00 2026-06-08T12:10:51+00:00

I received an error and I have this structure in my program public interface

  • 0

I received an error and I have this structure in my program

public interface Shapes<T>{
//methods here
}

public class ShapeAction<T> implements Shapes<T>{
//Methods and implementations here
}

public class Circle extends ShapeAction<T>{
//Some methods here
}

The error is pointing at class Circle extends Shapes<T> where it says “T cannot be resolved to a type”. If I set T to string the error will go away but that also means I can only use one datatype. What should I put inside the <> so that I can use any datatype (String, int, double etc) or did I do this the wrong way?

  • 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-08T12:10:53+00:00Added an answer on June 8, 2026 at 12:10 pm

    There are two different concepts. When you write

    public class ShapeAction<T>
    

    this means that you are creating a class which, when instantiated, will be parametrized with some class. You don’t know at the time which it will be, so you refer to it just as T.

    But when you write

    public class Circle extends ShapeAction<T>
    

    this means that you want Circle to be a subclass of ShapeAction parametrized with type T. But what is T? Compiler can’t tell that: you declared Circle without any type variables.

    You have two options. You can make Circle generic too:

    public class Circle<T> extends ShapeAction<T>
    

    This way when you make a new instance of Circle you specify what type it works with, and this extends to the superclass.

    And what if you want to specify that ShapeAction can be of any type, but without making the subclass generic? Use Object:

    public class Circle extends ShapeAction<Object>
    

    This way Circle stays non-generic, but you can use any data types with the superclass.

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

Sidebar

Related Questions

Within my ajax call if an error is received I have an alert :
I received this error on following code.Is this + sign is not available in
I am trying to initialize NSDictionary but it gives me following error: Program received
I have a class structure Class A { Object of classB Object of classC
I have this class in my parser.py file class HostInfo(object): def __init__(self, host_id): self.osclass
My Java application needs to serialize/deserialize an XML structure received via HTTP. This XML
Continued from this stackoverflow question . I have the following data structure: data =
I have an XML reader but I receive an error when I'm trying to
I have the following code, I receive an error at if statement saying that
When I tried to open my SharePoint extended site, I received error 500. The

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.