Integer注意_享元设计模式

来源:互联网 发布:8099端口是干嘛的 编辑:程序博客网 时间:2024/06/04 19:10

public class IntegerNote{

 public static void main(String[] args){
  Integer d1=100;
  Integer d2=100;
  System.out.println(d1==d2); //true

  Integer d3=129;
  Integer d4=129; 
  System.out.println(d3==d4); //false
 }
}
/*
 究其原因则涉及到java设计中的一个设计模式,享元设计模式
*/