这是我在 geeks for geeks 上找到的代码 我对类 Object 和什么是深度比较感到困惑 我对 Java 还是很陌生,我正在尝试尽可能深入地了解事物。请不要被我愚蠢的怀疑激怒
import java.util.Arrays;
class Test
{
public static void main (String[] args)
{
// inarr1 and inarr2 have same values
int inarr1[] = {1, 2, 3};
int inarr2[] = {1, 2, 3};
Object[] arr1 = {inarr1}; // arr1 contains only one element
Object[] arr2 = {inarr2}; // arr2 also contains only one element
if (Arrays.equals(arr1, arr2))
System.out.println("Same");
else
System.out.println("Not same");
}
}