title: Call method on multidimensional array
body: <p>Let's say I have a method like so:</p>
  
  <pre><code>public class ColoredPoint {
  
      private final Color color; 
      private final int x;
      private final int y;    
  
      public ColoredPoint(int x, int y, Color color) {
          this.x = x;
          this.y = y;
          this.color = color;
      } 
  
      public ColoredPoint(int x, int y, int color) {
          this(x,y, new Color(color));
      }  
  
      public int getX() {
          return x;
      }
  }
  </code></pre>
  
  <p>Then I populate a <strong>single dimension array</strong> with some data like so for example:</p>
  
  <pre><code>public class DemoInput {
  final static ColoredPoint[] test2 = new ColoredPoint[]
  { new ColoredPoint( 208, 324, -1 )
  , new ColoredPoint( 154, 313, -1 )
  , new ColoredPoint( 288, 316, -1 )
  , new ColoredPoint( 312, 296, -1 )
  }
  </code></pre>
  
  <p>How can I figure out the biggest x in the array? I have a method to get x from the ColoredPoint so this should be easy, right?</p>
  
  <p>I know I can use a for-loop for this. I just don't now to to get the x from the ColoredPoint inside the array.</p>
  
  <p>I want the x value of a ColoredPoint in the array called test2 in the class DemoInput so I thought:</p>
  
  <pre><code>DemoInput.test2.ColoredPoint.getX[i]
  </code></pre>
  
  <p>would do the trick but that doesn't work. </p>
  
  <p>Can anyone help me out? Also, how would it work for a <strong>multidimensional array</strong>, like such:</p>
  
  <pre><code>allTests = new ColoredPoint[][]
    { test1
    , test2
   };
  </code></pre>