Searching for "tostring()"

Q:

What is the use of tostring() method?

Answer

If we print any object by using println() or print() methods.


The println() or print() methods internally calls tostring() method and prints the return value of toString() method.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

Q:

What is the purpose of overriding toString() method?

Answer

we can override tostring() method to return String representation of our object data

Report Error

View answer Workspace Report Error Discuss

Subject: Java