why not Campbell,
We override toString() method from Object class to give meaningful
String representation of the Object.
Say your class is
My output is : Maintainance@767946a2
This is class name+'@'+hex version of the object hashcode. This doesn't make any sense
lets say i want to understand more about my object i will override this toString() method to this class
My output will be : Maintainance [name=Harshvardhan, age=25]
And this info makes sense. So its always good to have toString(). Similarly please read on equals() and hashcode() also.
I hope this will be helpful.
Thanks Campbell for figuring it out, i always make assumptions like this.