title: reading the maze file and print it
body: <p>This program is about maze recursion and I'm struggling finding out how to read the maze file and print the solved maze since I'm new in Java. Could anyone explain it to me how to call the print method from main method? Thank you in advance!</p>
  
  <pre><code>public class Maze {
  
      private static char[][] maze;
      private static int rows = 0;
      private static int columns = 0;
  
  
      public Maze(char[][] mazeIn) {
          maze = mazeIn;
      }
  
      private static boolean valid (int r, int c) {
  
            boolean result = false;
  
            // check if cell is in the bounds of the matrix
            if (r &gt;= 0 &amp;&amp; r &lt; maze.length &amp;&amp;
                c &gt;= 0 &amp;&amp; c &lt; maze[0].length)
  
               //  check if cell is not blocked and not previously tried
               if (maze[r][c] == '1')
                  result = true;
  
            return result;
  
         }  // method valid
  
      public static boolean solve (int r, int c) {
  
            boolean done = false;
  
            if (valid (r, c)) {
  
               maze[r][c] = '7';  // cell has been tried
  
               if (r == maze.length-1 &amp;&amp; c == maze[0].length-1)
                  done = true;  // maze is solved
               else {
                  done = solve (r+1, c);  // down
                  if (!done)
                     done = solve (r, c+1);  // right
                  if (!done)
                     done = solve (r-1, c);  // up
                  if (!done)
                     done = solve (r, c-1);  // left
               }
               if (done)  // part of the final path
                  maze[r][c] = '8';
            }
  
            return done;
  
         }  // method solve
  
      public static void print () {
  
            System.out.println();
  
            for (int r=0; r &lt; maze.length; r++) {
               for (int c=0; c &lt; maze[r].length; c++)
                  System.out.print (maze[r][c]);
               System.out.println();
            }
  
            System.out.println();
  
         }  // method print_maze
  
  
      public static void main(String[] args) throws IOException  {
  
        String fileName = "Maze.txt";
  
        try {
              String readline;
  
              FileReader fileReader = 
                      new FileReader(fileName);
  
                  BufferedReader br = 
                      new BufferedReader(fileReader);
  
                  int line = 0;
                  while((readline = br.readLine()) != null) {
                  System.out.println(readline); //loads the maze
  
                  char[] charArr = readline.toCharArray();
                  maze[line] = charArr;  // error here
  
                  line++;
                  }
  
          br.close();         
      }
  
      catch(FileNotFoundException ex) {
          System.out.println(
              "Unable to open file '" + 
              fileName + "'");                
      }
      catch(IOException ex) {
          System.out.println(
              "Error reading file '" 
              + fileName + "'");                  
  
          }
      }
  } 
  </code></pre>
  
  <p>the maze.txt file looks like this</p>
  
  <pre><code> 000100000000000  
   000100001000010  
   000111111111000   
   000100000001000  
   000111110001000  
   000000010001000  
   000011110001000  
   000010010001010  
   000010010000000  
   000010000000000  
   000011111110000  
   000000000010000  
   000000000010000  
   000001000011110  
   000000000010000  
  </code></pre>