Java 中支持多少个数组维度,例如 [1][1][1][1]....[1]? [英] How many array dimensions are supported in Java like a[1][1][1][1]....[1]?

查看:44
本文介绍了Java 中支持多少个数组维度,例如 [1][1][1][1]....[1]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java 中像 a[1][1][1][1]....[1] 支持多少个数组维度?我可以为数组声明无限数量的维度吗?

How many array dimension is supported in Java like a[1][1][1][1]....[1]? Can I declare an unlimited number of dimensions for an array?

推荐答案

数组维数限制为 255.

The number of array dimensions are limited to 255.

有趣的是,JLS定义的Java编程语言并没有这样的限制,但是你可以在JVM 规范,数组维度存储在 1 个字节中.

The interesting thing is that there is no such limitation in Java programming language defined by JLS, but you can see in the JVM specification, that the array dimension is stored in 1 byte.

但是,您在日常开发中几乎无法满足此限制.:-)

However, you can hardly meet this limitation on your day-to-day development. :-)

这篇关于Java 中支持多少个数组维度,例如 [1][1][1][1]....[1]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆