Answer :

The ToString( ) method is automatically invoked when an object reference is made in the Write( ) method.

Java has a built-in function called toString() that returns values in string format. As a result, a string object will be returned for each object to which this function is used. In Java, there are two ways to implement the toString() function. When a method of an object instance is called, the first implementation occurs. The second implementation occurs when the member method of the concerned class is called when the value is being passed as an argument. What's intriguing is that this function can also be overridden as a component of a class to meet the user's specific requirements.

Learn more about ToString( ) method here:

https://brainly.com/question/9512618

#SPJ4

Other Questions