问答详情
源自:3-6 [Hibernate单表操作] 单表操作CRUD实例

重写Address类的toString()怎么输出address=null呢?

输出结果如下:Student [stuId=1, stuName=李四, gender=男, birthday=2016-11-09 08:42:38.0, address=Address [postcode=351000, phone=059187654321, address=null], image=null]

提问者:夜还没黑 2016-11-09 08:47

个回答

  • Hopen
    2017-08-20 06:23:12

    @Override

    public String toString() {

    return address+ ", phone=" + phone + ", postcode=" +postcode; 

    }

    把这个放在Address类里

  • 慕九州8554320
    2016-11-20 21:39:15

    address已经在student类配置的文件里面删了的,打印不了的

  • 慕粉4015579
    2016-11-09 12:53:15

    重写tostring方法了没?