A length of the array java

Package Penalty for java03;
 / * 
* How to get the array length: 
* Format: 
* array name .length 
* 
* int length it will get a number that represents an array of 
* 
* Once the array is created, the program is running, the length can not be changed 
* 
* * / 

public  class Demo04ArrayLength {
     public  static  void main (String [] args) {
         int [] = arraya new new  int [. 3 ];
         int [] = {1,2,3,4,5,96,48,14,20,77 arrayb , 5,66,44,122,36,47,222,95,46,485,123 };
         int len = arrayB.length; 
        System.out.println ( "length arrayB array is:" + len); //21
        System.out.println("=================");

        int[] arrayC = new int[3];
        System.out.println(arrayC.length);//3
        arrayC = new int[5];
        System.out.println(arrayC.length);//5
    }
}

 

Guess you like

Origin www.cnblogs.com/spp666/p/11693409.html