Array Error
I am having some trouble with the following code:
publicclass CellClient
{
publicstaticvoid main(String[] args)
{
EasyReader kb =new EasyReader();
for(int game = 1; game <= 5; game++)
{
System.out.print("Please enter the size of the grid-->");
int arraySize = kb.readInt();
int[] gridArray =newint[arraySize + 2];
gridArray[0] = 0;
for(int loc = 1; loc <= gridArray.length - 2; loc++)
{
System.out.print("Please enter the state of cell #" + loc +
"-->");
String cellState = kb.readWord();
if(cellState =="D" || cellState =="d")
gridArray[loc] = 0;
else
gridArray[loc] = 1;
}
gridArray[gridArray.length - 1] = 0;
System.out.print("Please ennter the generation to output-->");
int number = kb.readInt();
Cell myCell =new Cell(gridArray, number);
System.out.print(myCell);
}
}
}
For some reason it skips theif
and goes straight to theelse
This means that every numberin the array turns out to be a 1.
By the way, readWord and readInt are methods that read from the keyboard.

