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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:11:12+00:00 2026-05-30T08:11:12+00:00

When compiling the code below, I get the following error: PersonalInformation is not abstract

  • 0

When compiling the code below, I get the following error:

PersonalInformation is not abstract and does not override abstract
method compareTo(Object) in Comparable

I assume that means I have a problem with my compareTo method. But everything seems to be all right. Anyone have a suggestion?

import java.util.*;
public class PersonalInformation implements Comparable
{
private String givenName;
private String middleInitial;
private String surname;
private String gender;
private String emailAddress;
private String nationalId;
private String telephoneNum;
private String birthday;

public PersonalInformation(String gN, String mI, 
        String sur, String gen, String eMa, String natId,
        String teleNum, String birthd)

{
        givenName = gN;
        middleInitial = mI;
        surname = sur;
        gender = gen;
        emailAddress = eMa;
        nationalId = natId;
        telephoneNum = teleNum;
        birthday = birthd;


}


public int compareTo(PersonalInformation pi)
{
 return (this.gender).compareTo(pi.gender);
}

}
  • 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-30T08:11:13+00:00Added an answer on May 30, 2026 at 8:11 am

    Do this:

    public int compareTo(Object pi) {
        return ((PersonalInformation )(this.gender)).compareTo(((PersonalInformation ) pi).gender);
    }
    

    or better

    public class PersonalInformation implements Comparable<PersonalInformation>
    

    If you implement the Comparable Interface you have to implement it either for all Objects using the first method or type your class the second way.

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

Sidebar

Related Questions

I get this error when compiling the following source from here : Error 1
How can I get rid of this error and other while compiling the below
Can anyone explain why I get the following errors when compiling the code shown
When compiling the following code: void DoSomething(int Numbers[]) { int SomeArray[] = Numbers; }
I'm trying to overload the dereference operator, but compiling the following code results in
Consider the following code: public abstract class RepositoryBase<T> where T : class { #region
When I try and compile this program, I get errors (included below the code)
I am dynamically compiling code in my client application. When I start the application
Take this non-compiling code for instance: public string GetPath(string basefolder, string[] extraFolders) { string
I'm getting a lot of errors compiling code using the boost libraries, mainly when

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.