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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:50:37+00:00 2026-05-30T21:50:37+00:00

My class header: public class GraphEdge implements Comparable<GraphEdge>{ /** Node from which this edge

  • 0

My class header:

public class GraphEdge implements Comparable<GraphEdge>{

/** Node from which this edge starts*/
protected Point from;
/** Node to which this edge goes*/
protected Point to;
/** Label or cost for this edge*/
protected int cost;

My compareTo method:

@Override
public int compareTo(GraphEdge other){
    return this.cost-other.cost;
}

but Eclipse gives me the error:

The method compareTo(GraphEdge) of type GraphEdge must override a superclass method

whyyyyy?
I tried just doing Comparable, with

@Override
public int compareTo(Object o){
            GraphEdge other = (GraphEdge) o;
    return this.cost-other.cost;
}

but this also failed.

  • 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-05-30T21:50:39+00:00Added an answer on May 30, 2026 at 9:50 pm

    Most likely your project is set to Java 1.5 compliance level – try setting it to 1.6 and it should work. Don’t have Eclipse here to test, however I remember that when set to 1.5 I could not use @Override on interface (but could on class) method overriding. This worked OK when set to 1.6.

    I.e. this should fail when set to 1.5, but work OK when on 1.6:

    interface A {
       void a();
    }
    
    class B implements A {
       @Override
       public void a() {
       }
    }
    

    So try it:

    • http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FgettingStarted%2Fqs-with-j2se50.htm

    enter image description here

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

Sidebar

Related Questions

Becase I've seen (and used) situations like this: In header.h: class point { public:
Good afternoon all, I have a class which looks like this: public class Grapheme
I have a class that starts with: public class GeneralID implements WritableComparable<GeneralID>{ ... }
I currently have this method header: public virtual void SetupGrid<T>() where T : class,
I try to create a multi-threaded singleton pattern class. Header: class HL{ public: static
I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream>
If I do this: // In header class Foo { void foo(bar*); }; //
I have a c++ header file containing a class. I want to use this
I have something like the following in the header class MsgBase { public: unsigned
This is the dependent class header #ifndef TransHeader #define TransHeader #include <string> #include CipherHeader.h

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.