数组的 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
     }
}

相关文章:

  • 2022-12-23
  • 2022-01-08
  • 2021-12-25
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-22
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2021-09-03
  • 2021-11-29
  • 2022-01-21
相关资源
相似解决方案