Java Question: Consider a maze made up of a rectangular array of squares. The maze will contain a character (either +, -, or |) to represent a blocked square, and to form the walls of the maze. Mazes will have only one entrance at the Coordinate (0, 1), with only one exit in the lower right hand corner of the maze. Beginning at the entrance to the maze, find a path to the exit at the bottom right of the maze. You may only move up, down, left, and right. Each square in the maze can be in one of four states: clear (space), blocked (X), path (.), or visited (*). Initially, after the maze has been read in from the file, each square will be either clear or blocked. If a square lies on a successful path, mark it with a period. If you visit a square but it does not lead to a successful path, mark it as visited with an asterisk. Solution import java.io.*; class Maze { // Any MazeSquare field is true if the corresponding // wall exists, and false otherwise. class MazeSquare { public boolean hasTopWall; public boolean hasRightWall; public boolean hasLeftWall; public boolean hasBottomWall; public MazeSquare() { hasTopWall = hasRightWall = hasLeftWall = hasBottomWall = false; } } // This Exception class will help pinpoint format errors in the data file. class MazeFormatException extends Exception { public final static int noError = 0; public final static int badRowAndColumnCounts = 1; public final static int wrongNumberOfEntriesInRow = 2; public final static int badEntry = 3; public int lineNumber; public int problem; public MazeFormatException( int line, int prob ) { lineNumber = line; problem = prob; } } // Number of rows and columns in the maze. private int nRows; private int nColumns; // The array of maze squares themselves. MazeSquare[][] square; public static void main( String[] args ) { if( args.length != 1 ) { System.err.println( \"Usage: java Maze mazeFileName\" ); System.exit( 1 ); } Maze knosos = null; try { knosos = new Maze( args[0] ); } catch( FileNotFoundException e ) { System.err.println( \"Can\'t open \" + args[0] + \". Check your spelling.\" ); System.exit( 1 ); } catch( IOException e ) { System.err.println( \"Severe input error. I give up.\" ); System.exit( 1 ); } catch( MazeFormatException e ) { switch( e.problem ) { case MazeFormatException.badRowAndColumnCounts: System.err.println( args[0] + \", line \" + e.lineNumber + \": row and column counts expected\" ); break; case MazeFormatException.wrongNumberOfEntriesInRow: System.err.println( args[0] + \", line \" + e.lineNumber + \": wrong number of entries\" ); break; case MazeFormatException.badEntry: System.err.println( args[0] + \", line \" + e.lineNumber + \": non-hexadecimal digit detected\" ); break; default: System.err.println( \"This should never get printed.\" ); break; } System.exit( 1 ); } knosos.print( System.out ); } public Maze() { square = null; nRows = nColumns = 0; } public Maze( String fileName ) throws FileNotFoundException, IOException, MazeFormatException { Buffered.