Getting unknown number of dimensions from a multidimensional array in Java

前端 未结 5 1620
天命终不由人
天命终不由人 2020-12-18 05:23

Is it possible in Java to find the number of dimensions of an array with an \'a priori\' unknown number of dimensions? That is, if one doesn\'t know the number of dimensions

5条回答
  •  我在风中等你
    2020-12-18 05:40

    Just look at its dynamic type either by looking directly in your code where it is initialized or by calling its class and examining its reflected attributes.

提交回复
热议问题