zoukankan      html  css  js  c++  java
  • java 变量 final 小结

    通过查看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());

    }

  • 相关阅读:
    3、Java基础类
    2、面向对象
    1、Java基础
    0.Eclipse
    【Python】UI自动化-1
    【Python】爬虫-2
    【Python】爬虫-1
    【Python】socket编程-3
    【Python】socket编程-2
    【Python】socket编程-1
  • 原文地址:https://www.cnblogs.com/c-abc/p/7374444.html
Copyright © 2011-2022 走看看