数组的 length 属性详解 1.数组中的 length 指该数组的元素的数量,比如A数组中有6个元素,最后的元素是A[5],length=6; 2.在定义数组时指定的也是数组元素数量length;例如:int [] A = new int[length]; 请看下面源代码:
public
class
test {
public
static
void
main(String[] args) {
//
TODO
Auto-generated method stub
int
length=10;
int
[] A =
new
int
[length];
System.
out
.println(
“A.length = “
+A.
length
);
//output`:A.length = 10
}
}
转载于:https://www.cnblogs.com/igeneral/archive/2013/04/04/2999338.html