The Best way to predict your future is to create it - Every great individual common man
Originally posted by Jerry Van:
When I try to run Debug on the LifeGameTester class, it terminates on the "game.setBoard(board);" line, and says that the cells field is null. I can't figure out why.
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Originally posted by Stevi Deter:
Sounds like you need to figure out why
is returning a board with null cells, or why game.setBoard(board) thinks cells is null.
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Originally posted by Stevi Deter:
Jerry,
If you're getting a NPE, why do you think it's because the cells field is null? On that specific line, the only way I can see that code throwing an NPE is if game is null (cannot call a method on a null object).
[ May 13, 2008: Message edited by: Stevi Deter ]
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
In the method check first if field�s value is null, and if it is create new Game instance and assign it to the field.
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Originally posted by Stevi Deter:
Jerry,
To be more explict, perhaps it should say
"In the method check first if the instance field's value is null. If it is null, create a new Game and assign it to the field. Return the field."
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Originally posted by Stevi Deter:
Jerry,
You're right, you can't instantiate an abstract class.
Given that you're making this call to get your instance:
where do you think the getInstance() call should be implemented?
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Originally posted by Jerry Van:
Well, I figured out how to get a printout of the cells, but it'snot exactly what I wanted.
With this code:
I get one long vertical column of the array content. Not exactly what I wanted, but at least it's something. Now, if I can just figure out how to make it look like the array, I'd be shootin' tootin'!
Joanne
Don't get me started about those stupid light bulbs. |