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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:34:26+00:00 2026-06-15T17:34:26+00:00

Given the header: public boolean equals(Name otherName) I’m supposed to compare two name objects

  • 0

Given the header:

public boolean equals(Name otherName)

I’m supposed to compare two name objects for equality. What I have right now is:

public boolean equals(Name otherName){
    return (name1.equalsIgnoreCase(name2));
}

However, I get an identifier expected error. I think it would work if I change the parameters but the assignment asks that I use that header. What am I doing wrong?

Here is the name constructor:

public Name (String first, String middle, String last){ 
firstName = first; 
middleName = middle; 
lastName = last; 
}
  • 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-15T17:34:27+00:00Added an answer on June 15, 2026 at 5:34 pm

    You get ” get an identifier expected error.” because name1 and name2 are defined. Inside equals method you pass another object so refer it as otherName and the object itself is accessible as this.

    Try

    public boolean equals(Name otherName) {
        return (otherName.equalsIgnoreCase(this));
    }
    

    or

     public boolean equals(Name otherName) {
        return (equalsIgnoreCase(otherName));
    }
    

    Of course, you should have equalsIgnoreCase implemented for Name class.

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

Sidebar

Related Questions

Given this code: //header.h template <class T> class Foo { public: Foo(T t) :
Given the following two header files: #ifndef EVENT_HANDLER_H #define EVENT_HANDLER_H #include <SFML/Window.hpp> #include <SFML/Window/Event.hpp>
The Sinatra README says : request[SOME_HEADER] # value of SOME_HEADER header Given this app:
It is given in the STL reference that string class is in string header,then
Given a function, let's say atoi, how can I find the header file I
given the html: <div class=ships> <div class=ship header> </div> <div class=ship> <div class=image> <img
I have an application layout in my rails app to give a default header/footer
Given that the web application doesn't have su privileges, I'd like to execute a
I'm trying to have a full screen UI with a fix header ( a
I have this definition in a header file: class Owner { private: // Fields

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.