0

what is the use of toString() method !??

12th Aug 2016, 4:45 PM
Hekanksh Gohel
Hekanksh Gohel - avatar
3 Respostas
+ 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
12th Aug 2016, 4:59 PM
Rahul Ghangas
Rahul Ghangas - avatar
0
okie.. thank youu
12th Aug 2016, 5:02 PM
Hekanksh Gohel
Hekanksh Gohel - avatar
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.
21st Aug 2016, 5:16 PM
Srikumar Krishna Iyer
Srikumar Krishna Iyer - avatar