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



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. import java.util.*;

public class de

View Tutorial          By: Virudada at 2012-05-05 06:27:22

2. in my case the culprit is xdebuger dll version 2.0
View Tutorial          By: putra at 2009-12-18 00:39:42

3. I did not understand it. please give one example e
View Tutorial          By: farhaan at 2008-03-20 12:06:11

4. how to connect the database in servelet use to sta
View Tutorial          By: sudhir singh tomar at 2011-04-28 03:10:34

5. i want ask whether how do i run the application?
View Tutorial          By: unknown at 2009-10-29 21:13:03

6. thank u. it is very useful for users
View Tutorial          By: c.balasubramani at 2008-09-24 03:55:47

7. Abstract class example is good, What is the differ
View Tutorial          By: megakumar at 2011-04-10 04:15:10

8. Hai,
dis is anu, dng final year. i need to

View Tutorial          By: anu at 2012-07-12 15:41:19

9. I am getting

jayana-desktop/127.0.

View Tutorial          By: GSA at 2010-11-23 02:36:26

10. I very grateful with this program it expand my ide
View Tutorial          By: Nuhu Abdullahi at 2015-06-13 11:42:38