title: static object array
body: <pre><code>public class Array                                                               
  {
      static String[] a = new String[] {"red", "green", "blue"};
      static Point[] p = new Point[] {new Point(1, 2), "3,4"};
  
      public static void main(String[] args)
      {
          System.out.println("hello");
      }
  
      class Point
      {
          int x;
          int y;
  
          Point(int x, int y)
          {
              this.x = x;
              this.y = y;
          }
  
          Point(String s)
          {
              String[] a = s.split(",");
              x = a[0].parseInt();
              y = a[1].parseInt();
          }
      }
  }
  </code></pre>
  
  <p>In the above program, the static <code>Point</code> array initialization fails, reporting error:</p>
  
  <pre><code>Array.java:4: non-static variable this cannot be referenced from a static context
      static Point[] p = new Point[] {new Point(1, 2), "3,4"};  
  </code></pre>
  
  <p>But, the static <code>String</code> array succeeds. What's the difference between them?</p>
  
  <p>I really need a static object array, because it's easy to refer to without instantiate the outer class.</p>
  
  <p>Thanks </p>