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. I did not understand it. please give one example e
View Tutorial          By: farhaan at 2008-03-20 12:06:11

2. the tutorial is good and i am satisfied to it i wa
View Tutorial          By: sheraz at 2011-11-07 02:08:55

3. Did you check if you are using the correct usernam
View Tutorial          By: Murugan at 2011-11-18 09:28:47

4. hi
very tnx for your code

View Tutorial          By: Moji at 2012-08-19 16:06:53

5. i didnot get the answer
View Tutorial          By: ramana at 2013-02-04 06:36:37

6. I get theses errors and apparrently it cannot find
View Tutorial          By: Abhaya at 2013-02-20 22:42:18

7. Please help here...
I tried both 0300460423

View Tutorial          By: Zafar Iqbal at 2013-04-02 20:14:29

8. i need some more basic java programs in all type
View Tutorial          By: jkamal at 2012-11-05 04:57:49

9. What about object bean with view scope?
View Tutorial          By: Awo at 2012-02-11 12:17:36

10. how to run file IO program?
isn't that must

View Tutorial          By: farah at 2009-08-24 02:41:59