Use of toString() method
When we print an object, internally the toString() method is called internally. toString() namaste print the hash code of the object. So if you want to print your own message instead of hashcode, just override toString() method and give your own implementation.
Comments
Post a Comment