How an object will call toString method implicitly?

后端 未结 5 1133
轮回少年
轮回少年 2020-11-28 09:20

If I am printing an object of the class then it is printing the toString() method implementation even I am not writing the toString() method so wha

5条回答
  •  自闭症患者
    2020-11-28 10:17

    Everything inherits from Object, so the toString on Object will be called if you have not defined one.

提交回复
热议问题