What is toString Method in Java with Example

preview_player
Показать описание
If you want to represent any object as a string, toString() method comes into existence.

The toString() method returns the string representation of the object.

If you print any object, java compiler internally invokes the toString() method on the object. So overriding the toString() method, returns the desired output, it can be the state of an object etc. depends on your implementation.

toString() method is present in Object Class.
Рекомендации по теме
Комментарии
Автор

Steps of explanation method to string is very good..

sonugupta
join shbcf.ru