HSSF comparing cell value to string variable

I am iterating through an excel file using HSSF looking for a match to a string variable I've declared. Basically, if it finds a match I want the loop to stop and perform some other action. For some reason it never seems to find a match. I've debugged and placed a watch on both variables and as it loops it looks like to me the strings match but it keeps on going.

As it loops I get the contents of the cell using:

HSSFRichTextString cellText = cell.getRichStringCellValue();

String cellValue = cellText.getString().toLowerCase();

I then have an if statement:

if (cellValue == declaredString)

{

doSomething

{

What am I missing here? Does it have something to do with RichText?

[740 byte] By [RDToola] at [2007-11-27 8:18:58]
# 1
Try:if (cellValue.equals(declaredString)){doSomething}
Bruno_Grassellia at 2007-7-12 20:07:14 > top of Java-index,Java Essentials,New To Java...
# 2
as Bruno pointed out, use .equals() to compare strings. == when used with objects is comparing references, and will only be true when both references are refering to the same object.~Tim
SomeoneElsea at 2007-7-12 20:07:15 > top of Java-index,Java Essentials,New To Java...
# 3
Thank you Bruno. That was what I needed.
RDToola at 2007-7-12 20:07:15 > top of Java-index,Java Essentials,New To Java...