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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:53:02+00:00 2026-06-05T23:53:02+00:00

im trying to override the add() but it will not compile public class AVLTree<E

  • 0

im trying to override the add() but it will not compile

public class AVLTree<E extends Comparable<E>> extends BinaryTree {  
BinaryNode<E> theTree;
    @Override
    public void add (E toInsert)
    {
        if (theTree == null)
    add(toInsert, theTree);     
    }


public class BinaryTree<E extends Comparable<E>> implements Iterable<E> {   
    public void add(E toInsert) { .... }

Error message

java:36: error: name clash: add(E#1) in AVLTree and add(E#2) in BinaryTree have the same erasure, yet neither overrides the other
public void add (E toInsert)
^
where E#1,E#2 are type-variables:
E#1 extends Comparable declared in class AVLTree
E#2 extends Comparable declared in class BinaryTree

  • 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-05T23:53:03+00:00Added an answer on June 5, 2026 at 11:53 pm

    As per my comment, BinaryTree is missing a type parameter when specialized by AVLTree.

    class BinaryTree<E extends Comparable<E>> implements Iterable<E> {   
        public void add(E toInsert) {
            // ...
        }
    
        public Iterator<E> iterator() {
            return null;
        }
    }
    
    class AVLTree<F extends Comparable<F>> extends BinaryTree<F> {  
        BinaryNode<F> theTree;
        @Override
        public void add (F toInsert)
        {
            // ...     
        }
    }
    

    http://ideone.com/dGqd8

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

Sidebar

Related Questions

I am trying a very simple override. I just want to add one line
I've been trying to override the file login.xml but no matter what I try,
I'm trying to add an dialog to an CustomPopoverViewController ( see picture ) but
First summary: class A extends AutoCompleteTextView { public A() { setOnKeyListner( ... new OnKeyLisnter()
I'm trying to create a facility that will add some interceptor to the registered
I am trying to override the DateTime template since I need custom class names
I am trying to figure out why, but I am not sure. I looked
Trying to override a tostring in one of my classes. return string.Format(@ name =
I'm trying to override a JSP in Liferay 6.1, namely html/portlet/enterprise_admin/settings/authentication.jsp. I have created
I'm trying to override a method inside a jquery widget. The method can be

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.