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. for user input use this method....
1. impor

View Tutorial          By: susmit at 2011-03-02 09:09:46

2. very simple explanation......
easily unders

View Tutorial          By: saurabh at 2009-04-17 16:02:30

3. ya it is better one and more helpful while learni
View Tutorial          By: sumithkrishnank at 2011-07-16 06:47:37

4. pls sed total informatio about c++
View Tutorial          By: anu at 2009-07-22 11:13:07

5. Where should I call the action /editRegistration?
View Tutorial          By: Andrei at 2013-03-08 12:21:07

6. Hi Binod,

Since JSP code is execute

View Tutorial          By: Aathi at 2009-05-28 21:20:10

7. this code runs permanently!!! created by diko(Turk
View Tutorial          By: ali at 2013-08-12 07:56:01

8. Hi, Thanks a lot for this wonderful written steps.
View Tutorial          By: Amar at 2012-09-09 17:19:58

9. i have run the program..bt there r so many excepti
View Tutorial          By: ayan at 2010-05-26 10:37:51

10. very easy and simple program..
need minor

View Tutorial          By: Metal at 2014-05-07 10:31:04