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.

[2225 byte] By [MRHSa] at [2007-11-26 17:49:57]
# 1
don't use == to compare strings, use .equals:if("D".equalsIgnoreCase(cellState))%
duffymoa at 2007-7-9 5:02:27 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks!
MRHSa at 2007-7-9 5:02:27 > top of Java-index,Java Essentials,Java Programming...
# 3
Yanked!Message was edited by: puckstopper31
puckstopper31a at 2007-7-9 5:02:27 > top of Java-index,Java Essentials,Java Programming...