Equals comparion with the same object should return false. Condition is you cannot override equals. Does anyone has any clue on how to solve this?

100 pts.
Tags:
Core Java
Write TestA class on such a way that the below program’s output should be false. 
 NOTE: You cannot override equals method 

 Class A{ 
public static void main(String args[]){
TestA testObj = new TestA(); System.out.println(testObj.equals(testObj)); 
}}


Software/Hardware used:
Java

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    What do you have for class TestA now? It doesn't matter right now if it causes true or false to be returned -- just show what you have and tell us the result.   You haven't asked a question yet, but you had this in your title:   Does anyone has any clue on how to solve this?   Yes, there are people who know ways to solve it. But what problem are you having?   Tom
    125,585 pointsBadges:
    report
  • kinshu22
    Its obvious that if we call equals on the same object it will give output as true. I have to write my own class TestA in such a way that if its object is compared to itself using equals it should return false
    100 pointsBadges:
    report
  • TomLiotta
    Its obvious that if we call equals on the same object it will give output as true.   It might be "obvious", but it's not always correct. The equals() method has requirements that are related to attributes of a class as far as true and false are concerned.   Show the TestA class that you have.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    There was some way to increment a property whenever an object was touched, or am I disremembering, again.
    49,435 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following