Results 1 to 4 of 4
  1. #1
    niu_niu is offline Member
    Join Date
    Jun 2010
    Posts
    48
    Rep Power
    0

    Default lost in labyrinth.

    Java Code:
    import java.io.*;
    import java.util.*;
    
    class MazeLoosers {
    	public void run( ) {
    		Maze m = new Maze( ); 
    		m.                        //what syntax shall I put here in order to run the Maze( ) in class Maze???
    }
    
    }
    
    class Maze {
    	    private int rows =0, cols = 0;
    		private char[ ][ ] store; 
    	    private MazeCell currentCell, exitCell, entryCell =new MazeCell( ); 
    	    private final char  exitMarker = 'e', entryMarker = 'm', visited = '.'; 
    	    private final char passage ='0', wall = '1'; 
    	    private Stack<MazeCell> mazeStack = new Stack<MazeCell>( ); 
    	    
    	    public Maze( ) {
    	    	int row =0, col =0; 
    	    	Stack<String> mazeRows = new Stack<String>( ); 
    	    	InputStreamReader isr = new InputStreamReader(System.in); 
    	    	BufferedReader buffer = new BufferedReader(isr); 
    	    	System.out.println("Enter a rectangular maze using the following " + "characters: \nm"); 
    	    }
    	    	
    	    }
    	
    	
    	class MazeCell {
    		public int x, y; 
    		public MazeCell( ){			
    		}
    		public MazeCell (int i, int j) {
    			x=i; y=j; 
    		}
    		public boolean equals(MazeCell cell) {
    			return x == cell.x && y== cell.y; 
    		}
    	}
    -------------------
    Hello again,

    what syntax do I need to put in the run () section, in order to invoke the Maze( ) function in class Maze?

    I know this is a really simple question, but I am a bit lost.

    Merci!

  2. #2
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    Maze m = new Maze( ); already called it

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,458
    Rep Power
    25

    Default

    to invoke the Maze( ) function
    I don't see a Maze() method in the Maze class. Only the constructor.
    A method returns a value or is void, the constructor does neither.

  4. #4
    niu_niu is offline Member
    Join Date
    Jun 2010
    Posts
    48
    Rep Power
    0

    Default

    makes sense. where was my mind??? cool profile picture btw.

Similar Threads

  1. Lost with subclasses
    By vinyacam in forum New To Java
    Replies: 3
    Last Post: 05-09-2010, 07:12 PM
  2. I'm lost :(
    By leonardjr in forum New To Java
    Replies: 8
    Last Post: 03-03-2009, 04:18 AM
  3. So Lost
    By kandt in forum New To Java
    Replies: 5
    Last Post: 12-13-2008, 09:55 PM
  4. Has Java lost its way?
    By alexj44 in forum Advanced Java
    Replies: 4
    Last Post: 09-23-2008, 01:26 PM
  5. Lost my javadocs
    By orchid in forum Eclipse
    Replies: 3
    Last Post: 04-30-2008, 09:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •