java: variable not known in current context?
<p>This line is generating a 'not known in current context' compiler error. Why?</p>

<pre><code>if (inputMatrix[newPosition.i][newPosition.j]=='*'){
        // variable not known in current context, why? 
        }
</code></pre>

<p>Method declaration: </p>

<pre><code> static Point moveForward(Point oldPosition, int matrixSize, char orientation, char [][] inputMatrix){

         // add possible new Position
        Point newPosition;

        //first return oldPosition border positions in which the robot shouldn't move 

        if ((orientation=='O')&amp;&amp;(oldPosition.j==0))
               return oldPosition;

        if ((orientation=='E')&amp;&amp;(oldPosition.j==(matrixSize-1)))
               return oldPosition;

         if ((orientation=='N')&amp;&amp;(oldPosition.i==0))
               return oldPosition;

         if ((orientation=='S')&amp;&amp;(oldPosition.i==(matrixSize-1)))
               return oldPosition;


         if ((orientation=='O'))
             newPosition = new Point(oldPosition.i, oldPosition.j-1);
         if ((orientation=='E'))
             newPosition = new Point(oldPosition.i, oldPosition.j+1);
        if ((orientation=='S'))
             newPosition = new Point(oldPosition.i-1, oldPosition.j);
        if ((orientation=='N'))
             newPosition = new Point(oldPosition.i+1, oldPosition.j);


        //then return oldPosition for positions in which the robot is blocked by *
        if (inputMatrix[newPosition.i][newPosition.j]=='*'){
        // variable not known in current context, why? 
        }




        return null;


    }
</code></pre>
