我正在学习 Java,只是想出了一个关于该语言的微妙事实:如果我声明两个具有相同元素的整数数组并使用==
结果比较它们是false
. 为什么会这样?比较不应该评估为true
吗?
public class Why {
public static void main(String[] args) {
int[] a = {1, 2, 3};
int[] b = {1, 2, 3};
System.out.println(a == b);
}
}
提前致谢!