Comment on Tutorial - The equals() Method example in Java By Baski



Comment Added by : Dinesh Chopra dc

Comment Added at : 2013-03-19 04:30:48

Comment on Tutorial : The equals() Method example in Java By Baski
Hi,

I think this is not a correct defination of equals method.
According to me correct definition is that

public class Book {
...
public boolean equals(Object obj) {
if(obj == null)
return false;
if(!(this == obj))
return false
if(getClass() != obj.getClass())
return ISBN.equals((Book)obj.getISBN());
else
return false;
}
}

Sorry if it have any errors...

DC :)


View Tutorial



Ask a Question

Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Thanks it worked for me after lot of search for CO
View Tutorial          By: VIRAJ at 2012-12-26 11:56:24

2. i need to send some file usin a bluetooth devicem
View Tutorial          By: igle85 at 2012-01-25 06:27:50

3. Just what I was looking for. Thank you.
View Tutorial          By: Babool at 2008-05-08 08:32:50

4. Hi,

Can we use this fix.php on the

View Tutorial          By: Chriz at 2010-07-05 09:22:57

5. thanks. worked.
View Tutorial          By: che at 2010-03-10 11:29:10

6. Who can send me the program and source to call thi
View Tutorial          By: Michael Chon at 2008-10-04 21:03:30

7. Hi,
All the information here was very much

View Tutorial          By: Shaiju at 2008-05-30 00:42:12

8. Nice Article, but these concepts are pretty confus
View Tutorial          By: Goldest at 2011-03-18 01:50:50

9. i am getting the following error:
cannot fi

View Tutorial          By: santhosh at 2009-09-24 09:13:57

10. Java s ssssss
View Tutorial          By: zoya at 2012-04-27 12:24:59