title: What's wrong with my constructor in this moving x matrix?
body: <p>The idea is each iteration will move the [x] every time it prints. However it obviously can't print a 0x0 matrix. As you can see I summoned the constructor in the program to have the variables 4, 4. Yet for some reason, after running it, the program still outputs 0,0.</p>
  <p>public class MovingX{</p>
  <pre><code>private int rowsN;
  
  private int columnsM;
  
  private int[][] matrixArr = new int[rowsN][columnsM];
  
  private int x = 0;
  
  private int y = 0;
  
  public MovingX(int n, int m){
     n = rowsN;
      
     m = columnsM;
     
  }
  
  public void forLoopGrid(){
              
      for(int i = 0; i &lt; matrixArr.length; i++){
          
          for(int j = 0; j &lt; matrixArr.length; j++){
           
              if(i == x &amp;&amp; j == y) System.out.print(&quot;[x] &quot;);   
              else System.out.print(&quot;[ ] &quot;);
  
          }
              System.out.println();
      }
          System.out.println();
  }
  
  public void moveX(){
       
       if(x &lt; rowsN) x++;
       else{
            x = 0; y++;
       } 
   
  }
  
  public void runProgram(){
  
      System.out.println(&quot;Program Starting&quot;);
      System.out.println(&quot;Rows, Columns: &quot; + rowsN + &quot; &quot; + columnsM);
      for(int i = 0; i &lt; (rowsN * columnsM); i++){
       System.out.println(&quot;Stuff happening&quot;);
       forLoopGrid();
       moveX();
      }
      System.out.println(&quot;Program Ending&quot;);
  
  }
  
  public static void main(String[] args){
       
      MovingX xLoop =  new MovingX(4, 4);
  
      xLoop.runProgram();
      
  }
  </code></pre>
  <p>}</p>