Monday, 23 May 2011

Arrays in java

class Arrays {
  public static void main (String[] args) {
    int[] list = new int[5]; // creates Array of 5 integers
    for (int index=0; index < 5; index++) {
      list[index] = index * 2; // Assign values to Array
    }
    for (int index=4; index > -1; index--) {
      System.out.println(list[index]);
    }
  } // method main
}


Post a Comment