Defining Initialized Arrays

  1. Arrays of primitive types can be initialized:

    Example: defining an initialized array
         int[] A = {1, 4, 3, 6, 5, 6, 9, 8, 9, 10};
    
    is equivalent to:
    
         int [] A = new int[10];
         A[0] = 1; A[1] = 4; A[2] = 3; A[3] = 6; A[4] = 5;
         A[5] = 6; A[6] = 9; A[7] = 8; A[8] = 9; A[9] = 10;