Java Arrays.equals() returns false for two dimensional arrays

后端 未结 2 1146
清歌不尽
清歌不尽 2020-11-28 06:30

I was just curious to know - why does Arrays.equals(double[][], double[][]) return false? when in fact the arrays have the same number of elements and each element is the sa

2条回答
  •  春和景丽
    2020-11-28 07:13

    java does not actually have multidimensional arrays. Instead it has only single dimensional array and the multi d arrays will be arrays of this 1d arrays . String.equals() can be only performed to the basic , single block arrays and hence it doesn't work for multidimensional arrrays.

提交回复
热议问题