The obvious answer is that input.readLine() is returning null, and since you are calling a method of an object that is pointing to nothing, you are getting a NullPointerException.
The root of this problem though, is the discrepancy between your perception of rows and columns and that of the text file. Also, you are looping through the incorrect index, if I am reading your code correctly.
Here is an example text file:
4 6 a b c d b c d a a d c a b d b a c d a a b a b a
A good way of thinking about this is to think about the number of rows and columns you have.
For example, the text file above says "I have 4 columns and 6 rows".
That also means x ranges from 0 to 3 and y ranges from 0 to 5.
In your terms, the x-length is the number of columns, and the y-length is the number of rows.
Of course, remember that rows go across, and columns go downwards, assuming the indices are increasing.
This is very important. Because x and y are essentially indices to a specific location in the grid.
Although that is probably the cause, you also have a few semantic errors that I'll fix below.
BufferedReader input = new BufferedReader(new FileReader("maze.txt")); //Read the first two lines of the text file and determine the x and y length of the 2d array int mazeWidth = Integer.parseInt(input.readLine()); //A.K.A number of columns int mazeHeight= Integer.parseInt(input.readLine()); //A.K.A number of rows // ranges: [0...3][0...5] in our example mazeArray = new char[mazeWidth][mazeHeight]; char [] line; //Add each line of input to mazeArray for (int y = 0; y < mazeHeight; y++) { line = (input.readLine()).toCharArray(); if ( line.length != mazeWidth ) { System.err.println("Error for line " + y + ". Has incorrect number of characters (" + line.length + " should be " + mazeWidth + ")."); } else { System.out.print(y + " : "); System.out.println(java.util.Arrays.toString(line)); mazeArray[y] = line; } }