我试图将两个整数与以下情况进行比较,得到了意想不到的结果
当我执行以下操作时,@@@ 被打印出来。
class C { static Integer a = 127; static Integer b = 127; public static void main(String args[]){ if(a==b){ System.out.println("@@@"); } } }
当我执行以下操作时,@@@ 未打印。
class C { static Integer a = 145; static Integer b = 145; public static void main(String args[]){ if(a==b){ System.out.println("@@@"); } } }
谁能告诉我可能是什么原因。