Initialize a static arrayTag(s): Language


public class InitStaticArray {

  static Integer[] integerArray;
  static {
    integerArray= new Integer[] {
        new Integer(1),
        new Integer(2),
        new Integer(3),
        new Integer(4),
    };
  }

  public static void main(String args[]) {
    for (int i=0; i < integerArray.length; i++){
      System.out.println(integerArray[i]);
    }
  }
}

blog comments powered by Disqus