对象属性拷贝 发表于 2021-05-14 分类于 后端 使用org.springframework.beans.BeanUtils的对象拷贝1、代码12345678public static void main(String[] args) { Student stu=new Student(); CollegeStudent col=new CollegeStudent("段友元",22,"男"); System.err.println(col); System.err.println(stu); BeanUtils.copyProperties(col,stu); System.err.println(stu); } 2、运行结果123CollegeStudent{name='段友元', age=22, gender='男'}Student{name='null', age=null}Student{name='段友元', age=22} 打赏 微信支付 本文作者: 段友元 本文链接: https://duanyouyuan.github.io/2021/05/14/对象属性拷贝/ 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!