returning results of a method 2x
Hi.
I have an applet that calls a method twice in the init() . Each time the method is called, two different boolean parameters are passed to it. At the end of the method is a return statement which returns the results of an integer multi-variable called grid. However for some reason Java doesn't seem to call the method twice, but instead assigns the second call from memory. Can someone please let me know how to fix this problem.
//Declare variables and Data Types
int[][][] grid =newint[16][16][3];
int[][][] player =newint[16][16][3];
int[][][] computer =newint[16][16][3];
//setUpPlayer()
publicint[][][] setUpPlayer(boolean ispc){
// ... Code That Generates the grid ...
return grid;
}
//Init()
publicvoid init(){
player = setUpPlayer(false);
computer = setUpPlayer(true);
}
So why are the computer and player objects the same. That is, why is player[16][16][3] = computer[16][16][3] = grid[16][16][3] ? Shouldn't the return statement be different every time the setUpPlayer() is called ?
Please help.

