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
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Java program to get location meta data from an image
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
Archived Comments
1. hi all !
This is the error im getti
View Tutorial By: Ajit at 2010-02-17 23:09:47
2. nice examples,but i have one problem in my project
View Tutorial By: swati at 2015-04-30 10:48:13
3. What happens if applied to an integer array?
View Tutorial By: SHUVO at 2015-07-01 21:14:16
4. Thank you!!!!!
View Tutorial By: wsjonly at 2013-09-19 18:41:50
5. A very good demonstration o Vector!!
View Tutorial By: Pankaj Kumar Mishra at 2010-12-09 01:35:06
6. Many thanks!
View Tutorial By: Bego at 2014-07-10 08:48:02
7. i want to know about java related topic in simple
View Tutorial By: saurav at 2010-04-29 04:39:55
8. i want to need SCJD Dums. so please help me that w
View Tutorial By: Dayamay singh at 2009-01-03 00:07:06
9. I think the programmer overlooked that "this
View Tutorial By: Joe Schmoe at 2010-10-16 00:01:27
10. this is the best example of method overriding but
View Tutorial By: Dipesh at 2009-09-09 12:52:21