class Test{
    
    public static void main(String[] args){
           //当值在[-128,127]中,不创建新的Integer

            Integer f1 = 100,f2 = 100,f3 = 150, f4 = 150;
            System.out.println(f1 == f2); //true
            System.out.println(f3 == f4); //false
}

}

 

相关文章:

  • 2022-12-23
  • 2021-10-31
  • 2021-12-18
  • 2021-12-18
  • 2021-12-18
猜你喜欢
  • 2021-12-31
  • 2021-12-07
  • 2021-10-07
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案