toString的作用就是对对象进行“自我介绍”,一般子类对父类提供的toString都不满意,都要进行重写

    toString()方法会返回一个“以文本方式表达”此对象的字符串

    • IDEA快捷键
      • Alt + insert
        1. - ![image.png](https://cdn.nlark.com/yuque/0/2021/png/2560440/1629251604825-28fd1589-5abf-4730-afac-1c34b58daa27.png#clientId=u19fd46e1-ebc7-4&from=paste&height=96&id=u83220595&margin=%5Bobject%20Object%5D&name=image.png&originHeight=192&originWidth=324&originalType=binary&ratio=1&size=6632&status=done&style=none&taskId=u03c57bce-aa36-45fa-bb25-02f7038795d&width=162)
    1. - ![image.png](https://cdn.nlark.com/yuque/0/2021/png/2560440/1629251621573-e4b07191-bb3f-4d51-9d4a-2aae91914780.png#clientId=u19fd46e1-ebc7-4&from=paste&height=91&id=u3ac19480&margin=%5Bobject%20Object%5D&name=image.png&originHeight=182&originWidth=793&originalType=binary&ratio=1&size=57046&status=done&style=none&taskId=ud4a1a1e3-22ee-4e63-ace7-e5c2a879d4b&width=396.5)