toString n. 将日期时间值转换成"日期/时间"形式的字符串值;转换对象为字符串
- As before, we omit the curly braces "{…}" around the body of toString, since it has only one expression.
像之前一样,我们省略了toString 方法主体两边的大括号“{…}”,因为我们只有一个表达式。 - That way everything is in one place (the field declaration), and I get my useful description out of toString() without needing to maintain the code.
这样,所有的东西都在一个地方(字段声明中),而且获得了 toString() 的有用的描述而无需维护代码。 - Decorating a class with "case" causes it to have a constructor generated that requires the attributes of the class, as well as implementations of equals, hashCode, and toString.
用 “case” 修饰一个类会导致这个类生成这样一个构造函数:这个构造函数需要类的属性,以及 equals、 hashCode 和 toString 的实现。