hello, i have made the code below. however, when comparing the two strings they are not equal when in theory i thought they would be.

 String word="abc";
        String d="";
        d += "a";
        d += "b";
        d+= "c";
System.out.println("IS EQUAL");

When i just print out string d it prints out abc, but for some reason its not REALLY abc. why?

You're comparing references of string objects. Use String.equals() method to compare strings:


i knew it was something like that >.<

thanks a ton