Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 34 of 34

Thread: Game of Life, help with Array Object? Quite puzzled

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    That is not a compiler error. You get that error when you execute a program.
    Did you get any compiler errors? Don't try to execute the code, just compile it.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Member
    Join Date
    Sep 2012
    Posts
    35
    My Mood
    Lurking
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    I don't even know where the compiler is. Pretty sad.

  3. #28
    Member
    Join Date
    Sep 2012
    Posts
    35
    My Mood
    Lurking
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    Ok found something. It says matrix has the value null at this spot.
    public static void printWorld(boolean[][] matrix) {
    		for (int r=0; r<matrix.length; r++) {
    			for (int c=0; c<matrix[0].length; c++) {
    				System.out.print(matrix[r][c] ? " # " : " - ");
    			}
    			System.out.println();
    		}

  4. #29
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    I supposed you're using an IDE that hides all that.

    Next step is to fill in the new constructor. You will need read the Specifications to get the details of what arguments the constructor gets and what its supposed to do with them.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    Source of the null matrix:
    	public boolean[][] world() {
    		// TODO Auto-generated method stub
    		return null;
    	}

    The methods are skeletons. The code can't be executed yet without errors.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    Member
    Join Date
    Sep 2012
    Posts
    35
    My Mood
    Lurking
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    I have absolutely no idea. Honestly just want to Q.Q

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    Talk to whoever wrote the code in post#1 about how to rewrite it to make it fit with the new code from your professor.

    Make a list of the specifications for the constructor and work on the items one by one.

    Many of the values passed in the constructor's args are what your main() method asked for and read in from the user. Now those values are coming as args in the constructor.
    Last edited by Norm; September 17th, 2012 at 09:44 PM.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #33
    Member
    Join Date
    Sep 2012
    Posts
    35
    My Mood
    Lurking
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    Think you could fix it in 10 minutes and save my ass? Lol just kidding, you have done enough. Thanks for the help. Have a good night.

  9. #34
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game of Life, help with Array Object? Quite puzzled

    Good luck and good night.

    Back tomorrow.
    If you don't understand my answer, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Game of Life 2-D matrix random seed boolean array PLEASE
    By Eriosblood in forum Collections and Generics
    Replies: 20
    Last Post: September 3rd, 2012, 06:10 PM
  2. [SOLVED] Pass-by-Value scheme, puzzled with passing/assigning a reference to another object
    By chronoz13 in forum Java Theory & Questions
    Replies: 10
    Last Post: June 2nd, 2012, 10:43 AM
  3. Read in file and store in 2D array start of The Game of Life
    By shipwills in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 2nd, 2011, 09:52 AM
  4. Game of Life GUI Error
    By Lavace in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 3rd, 2011, 09:15 AM
  5. Replies: 1
    Last Post: March 28th, 2009, 07:21 AM