Java中的数组长度属性 [英] array length property in java
问题描述
请不要介意,这只是一个关于数组长度属性的简单问题.作为Java的初学者,我遇到了Constants和final关键字,其描述为:
please don't mind this is just a simple question on array length property. As a beginner in Java I came across Constants and final keyword, which is described as:
常量是不可修改的变量,用关键字final声明.它们的值在程序执行期间不能更改.另外,必须在声明期间初始化常量.例如:
Constants are non-modifiable variables, declared with keyword final. Their values cannot be changed during program execution. Also, constants must be initialized during declaration. For examples:
final double PI = 3.1415926; // Need to initialize
我已经阅读了几乎所有相关文章,但是我对其初始化感到困惑.我尝试使用Netbeans IDE进入其类,但是在那里看不到它的实现.
I have read nearly all the related posts, but I have a confusion about its initialization. I've tried to dive into its class using Netbeans IDE but it's implementation was not visible there.
要获取数组长度的length字段呢?
http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.7
What about the length field to get the length of an array?
http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.7
如何以及何时初始化(运行时/编译时)?
How and when it is initialized (runtime/compiletime)?