0
what is the use of toString() method !??
3 Réponses
+ 3
It is used to return any data as a string which can be accessed elsewhere. For eg. To return the name, date of birth of an object Person, toString () method can be used to return a string as follows-
" I know a person named "+ name + " who was born on " + dateofbirth
0
okie.. thank youu
0
When an object is printed the toString method is fired... If it is available. I. E. If you have defined it in the object's class.
Application :used in dto or pojo classes which is very useful to know the latest data present in the object.