java toString() returning this

前端 未结 2 535
遇见更好的自我
遇见更好的自我 2021-01-24 06:17

In String toString() method returns this and when i pass it System.out.println() it prints the content of the String. It is c

2条回答
  •  抹茶落季
    2021-01-24 06:30

    The toString method, defined on Object in Java is responsible for converting the object to a String representation. Since String is already a String, the toString method simply returns itself.

提交回复
热议问题