Mysql Java string get value of reference
I have a result from a MySQL call in Java...
When I try to compare the string in an If statement, it does not
compare... because the operator == compares the string objects rather than
the value they contain (references)...
Is there a way to return the value rather than the reference to the value
in the following code?
while(rs.next())
{
String name = rs.getString( "name" );
if( name == "whatever" )
{
// Do something
}
}
The thing is, I understand the equal function does this, I was just
wondering if it's possible to get to the value of the referenced memory.
"pointer to value" kind of thing?
No comments:
Post a Comment