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 am looking for the code which wiLL HAVE AFFECT I
View Tutorial          By: pooja at 2013-06-10 13:48:32

2. can you clearly reveal how to create crystal repor
View Tutorial          By: halim at 2011-07-02 00:28:48

3. Following line
if (strcmp(dp->

View Tutorial          By: Sebastiaan Jaarsma at 2012-12-24 19:28:43

4. it's very good to understand...and it is helpful f
View Tutorial          By: Rakesh at 2009-12-26 00:14:59

5. meow is simple and awesome
View Tutorial          By: vishnu prasanth at 2013-01-10 10:00:35

6. this text is overlapping the existing text what if
View Tutorial          By: Alda at 2015-10-02 18:22:22

7. hi....!
This program is working well in co

View Tutorial          By: param at 2014-10-15 07:02:49

8. Very nice
View Tutorial          By: sharath at 2012-07-17 11:31:20

9. How about using stack in microprocessor subj.??? d
View Tutorial          By: Private at 2015-08-18 01:43:18

10. Very clear and instructive. Better than other expl
View Tutorial          By: cembircan at 2015-06-10 15:45:01