Java-Overriding toString Method

Overriding toString Method The toString( ) method returns a string that contains a description of the object on which it is called. If you want to represent any object as a string, toString() method comes into existence. Many classes override this method. This method is automatically called when an object is output using println( ). Program : Without … Read more…