/**
 * This class demonstrates use of "length" field for arrays
 * as well as for loops and the foreach loop.
 *
 * @author Sara Sprenkle
 *
 */
public class ArrayLength {  
    
   /**
    * Called when user runs 
    *  java ArrayLength
    */
    public static void main(String[] args) {
        int[] array = new int[10];
        
        for (int i = array.length -1; i >= 0; i--) {
            System.out.println(array[i]); 
        }
        
        for (int i = 0; i < array.length; i++) { 
            array[i] = i * 2; 
        }

        for (int i = array.length -1; i >= 0; i--) {
            System.out.println(array[i]); 
        }
        
        // alternative for loop to iterate through the array
        for( int element : array ) {
            System.out.println(element);
        }
        
    }
    
}
