Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: equals method is never called

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default equals method is never called

    Hello. My equals method is never called and i cannot see why. any help?
    	@Override 
    	public boolean equals(Object o){
    		Assessment a=(Assessment) o;
    		if(this.getCandidate().equals(a.getCandidate())){
    			if(this.getAnswers().equals(a.getAnswers())){
    				if(this.getDate().equals(a.getDate())){
    					System.out.println("I am here");
    					return true;
    				}
    			}
    		}
    		return false;
    	}


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,372
    Thanks
    183
    Thanked 836 Times in 779 Posts
    Blog Entries
    5

    Default Re: equals method is never called

    Please read the forum rules. Duplicate of overwritten equal method does not work
    Thread locked.

Similar Threads

  1. create an equals() method that overrides the object equals() method
    By slinky29 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 3rd, 2013, 11:11 PM
  2. equals() method.
    By TP-Oreilly in forum Object Oriented Programming
    Replies: 2
    Last Post: February 11th, 2012, 11:59 AM
  3. Using the .equals method
    By TenaciousE in forum Java Theory & Questions
    Replies: 2
    Last Post: October 23rd, 2011, 06:24 PM
  4. Method Equals, Boolean...
    By boys8goods in forum Object Oriented Programming
    Replies: 1
    Last Post: June 25th, 2011, 04:34 PM
  5. Equals Method
    By Sninald in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 18th, 2010, 03:06 AM