public class ArrayBasics {
  
  
  public static void main(String[] args) { 
    
    int[] numbers = new int[5];
    numbers[0] = 14;
    numbers[2] = 10;
    numbers[1] = 8;
    numbers[3] = 1;
    numbers[4] = 5;
    
    /*These compile but produce runtime errors. why?
    numbers[5] = 0;
    numbers[-1] = 7;
    */
    
    //numbers.length stores the capacity of the array "numbers"
    for(int i=0; i<numbers.length; i++){
      System.out.print(numbers[i]+" ");
    }
    System.out.println();
    
    int count=0;
    char[] letters = new char[100];
    for(char ch='A'; ch<='Z'; ch++){
      letters[count] = ch;
      count++;
    }
    
    for(int i=0; i<count; i++) {
      System.out.println(letters[i]);
    }
    //Arrays have 2 "lengths":
    //capacity / allocated length = the number of elements my array
    //                              has room for.
    //
    //number of elements / logical length = the number of elements
    //                                      in the array I care about.
    //for the array "letters" above, the capacity (AKA letters.length) is 100,
    //but its logical length is 26. 
    
  
  
  }  
}
