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



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. 29. It is not a deadlock. What will actually happe
View Tutorial          By: Sasha at 2012-01-24 14:34:03

2. Good Introduction to start j2me.thanks
View Tutorial          By: Ravinder Kasarla at 2008-12-26 06:59:29

3. Thanks
View Tutorial          By: Akhilesh at 2010-04-05 11:31:17

4. hi

im trying to run this project an

View Tutorial          By: VoyRufino at 2010-01-26 10:03:11

5. man i really havnt got your last example. how it g
View Tutorial          By: rakesh at 2013-02-21 08:20:29

6. good example tnq...........
View Tutorial          By: SaidiReddy at 2012-06-09 12:03:09

7. give me some logics for programs as soon as possib
View Tutorial          By: nari at 2011-12-07 18:28:03

8. help
View Tutorial          By: sne at 2012-08-10 07:13:28

9. i am converting from Visualbasic 6 to java web app
View Tutorial          By: Qui at 2010-01-05 07:26:07

10. grazie!!!
View Tutorial          By: Egidio De Lorenzo at 2011-04-20 12:07:25