Explain Array initializer

Array initializer: This is an initializer for an array. The initializer takes the position of separate creation and initialization steps. For example, the initializer

int[] pair = { 4, 2, };

is equal to the four statements as shown below:

    int[] pair;
    pair = new int[2];
    pair[0] = 4;
    pair[1] = 2;

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.