previous | start | next

Initial values of an Array

An array instance can be initialized when the array is created:

      // In a declaration
      int[] x = {2, 5, 8};
or
      int[] x = new int[] {2, 5, 8};

or

      int[] x;

      x = new int[] {2, 5, 8};

   


previous | start | next