toString的作用就是对对象进行“自我介绍”,一般子类对父类提供的toString都不满意,都要进行重写
toString()方法会返回一个“以文本方式表达”此对象的字符串
IDEA快捷键
- Alt + insert
![20220427191409](https://xleixz.oss-cn-nanjing.aliyuncs.com/typora-img/20220427191409.png)
![20220427191415](https://xleixz.oss-cn-nanjing.aliyuncs.com/typora-img/20220427191415.png)