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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:55:29+00:00 2026-06-13T07:55:29+00:00

New to java, I did search for examples, but I’m having a really hard

  • 0

New to java, I did search for examples, but I’m having a really hard time.

I have a node class that uses generics:

public class Node<T> {

    private int key;
    private T data;
    private Node<T> nextNode;

}

The node is Okay.

public class GenericDictionary implements GenericDictionary_interface {

    private int capacity;
    private Node<T> [] slots;

    public void add (Node<T> newNode) {

    }
}

This is how I would write it, I think. I want the GenericDictionary to work with node objects.

I get an error: “T cannot be resolved as a Type”.

Thing is I don’t know how it should look like.

  • 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-13T07:55:30+00:00Added an answer on June 13, 2026 at 7:55 am

    Your GenericDictionary class would need to be generic as well:

    public class GenericDictionary<T> ...
    {
    }
    

    At that point, it’ll be fine to use Node<T> within the class.

    If the interface contains the add method, the interface should probably be generic too:

    public class GenericDictionary<T> implements Dictionary<T>
    {
    }
    

    I’d advise against an interface called GenericDictionary_interface, by the way… if there’s only ever going to be one implementation, you could call the interface GenericDictionary and the implementation GenericDictionaryImpl – somewhat horrible, but reasonably common. If there are multiple implementations, name the implementation by some differentiating aspect.

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

Sidebar

Related Questions

Ok i am kind of new to java, but I did google search for
I'm new to Stack and this is my first question, but I did search
I did search briefly but not really sure what I'm asking. Just dipping my
I'm new to Java and have searched for quite a time now on the
I am new to java and learning interfaces. I did not understand the use
I am starting a new Java web project that will be worked on by
java.util.Date date = new java.util.Date(); java.sql.Date today = new java.sql.Date(date.getTime()); //2012-03-23 java.sql.Time time =
I am new to java and I have been testing my application all day
From the various online articles on Java 7 I have come to know that
I have a small Java desktop app that uses Swing. There is a data

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.