记录一个引用类型题目
Customer customer1 = new Customer();
customer1.setName("aaa");
List<Customer> listTest = new ArrayList<Customer>();
listTest.add(customer1);
Map<String,Customer> map3 = new HashMap<String, Customer>();
map3.put("1",customer1);
Customer customer2 = map3.get("1");
customer2.setName("bbb");
System.out.println(customer2.getName());
System.out.println(customer1.getName());
System.out.println(map3.get("1").getName());
System.out.println(listTest.get(0).getName());
输出结果:
bbb
bbb
bbb
bbb