Few interesting best practice on basic java development. To be archived for future use.
Many a times we override default behavior of Object class. we need to take utmost care while overriding those methods by ourselves about their contracts. Moreover, we need to write unit tests for our implementation. Consider using Apache and other libraries. They are here to rescue us and save our development time….
1. Do you wish to override toString() method? Don’t do it yourself….
toString() method returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
Instead of writing one on your own, try using apache commons class as:-
View original post 222 more words