class User(val age: Int, val name: String) { override def toString: String = s"[age = $age, name = $name]"} 这样在打印对象的时候打印的就不是地址值了.