That is a well-know Java
weirdness 'feature', try, for instance
public class Str
{
public static void main(String args[])
{
String a = "foo";
String b = "fo";
b += "o";
if ( a == b)
{
System.out.println("the strings are ==");
}
if ( a.equals(b))
{
System.out.println("the strings are equal(s)");
}
}
}
If you want (you usually want) to compare the
content of the two strings then use the
equal
method.