Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
标题是不言自明的,但我将其作为一个问题提出:有没有办法获得二维数组的子长度?例如
Vec2 vectors[][] = {{new Vec2(x1,y1),new Vec2(x2,y2)},{new Vec2(x3,y3),new Vec2(x4,y4),new Vec2(x5,y5)}};
Java 多维数组是锯齿状数组。 所以没有直接的方法来获取数组(子数组)的数组长度。相反,您可以获取子数组并继续length使用它。
length