Comment on Tutorial - equals( ) Versus == in Java By Mashoud
Comment Added by : Javin @ eclipse remote debugging
Comment Added at : 2011-04-09 06:50:44
Comment on Tutorial : equals( ) Versus == in Java By Mashoud
Here is my approach for writing equals() method from <a href="http://javarevisited.blogspot.com/2011/02/how-to-write-equals-method-in-java.html">How to write equals method in Java</a>
1) Do this check -- if yes then return true.
2) Do null check -- if yes then return false.
3) Do the instanceof check if instanceof return false than return false
4) Type cast the object; note the sequence instanceof check must be prior to casting object.
5) Compare individual attribute start with numeric attribute because comparing numeric attribute is fast and using short circuit operator so if first field does not match , don't try to match rest of attribute and return false.
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
3. hi i am new to JSP wht is class.forname in the cod
View Tutorial By: chanti at 2011-05-07 03:02:26
6. thank you so much i learn from your tutorial i wis
View Tutorial By: Anonymous at 2009-01-03 20:08:41
8. easy to understand and it helped me a lot in prepa
View Tutorial By: shandini at 2011-04-14 13:14:33
9. Hii.... We are B.Tech 4th year students. We are wo
View Tutorial By: Shipra Malik at 2010-08-17 03:32:34