通过查看hashCode发现,变量声明final后,不能修改,上级修改时候,重新获得对象hashCode变化
public static void main(String[] args) {
// TODO Auto-generated method stub
Document sss=new Document().append("aaa","ssss");
System.out.println("DA==="+sss.toJson()+ "@" + sss.hashCode());
ProcessTextMsg.start(sss);
sss.put("aaa","改变");
System.out.println("DA==="+sss.toJson()+ "@" + sss.hashCode());
}
=======================
public static void start(final Document eventMsg){
System.out.println(eventMsg.hashCode());
try {
Thread.sleep(111);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(eventMsg.hashCode());
System.out.println(eventMsg.toJson());
}