@Override public String toString() { return "Player{" + "name='" + name + '\'' + ", age='" + age + '\'' + ", email='" + email + '\'' + ", ff=" + ff + '}';
} public static void main(String[] args) throws InstantiationException, IllegalAccessException {
Player player = new Player();
player.age = "234";
player.name = "asd";
player.email = "qq";
player.ff = 34;
Player player2 = new Player();
BeanUtils.copyProperties(player, player2);
BeanUtils.copyProperties(player2, player);
System.out.println(player2.toString());
System.out.println(player.toString());
}
}Player{name='null', age='null', email='null', ff=null}Player{name='asd', age='234', email='qq', ff=34}Process finished with exit code 0
添加回答
举报
0/150
提交
取消