Hi everyone. Here’s a quick post that might save you a lot of time. With some programming languages like JavaScript, @Formula or LotusScript, to compare a String value is pretty simple

@Formula: tmp1 := “Test”;

tmp2 := “Test”;

(tmp1 = tmp2) = True

JavaScript:var tmp1 = “Test”;

var tmp2 = “Test”;

(tmp1 == tmp2) = True


LotusScript:dim tmp1 as String

dim tmp2 as Stringtmp1 = “Test”

tmp2 = “Test”

if(tmp1 = tmp2) = True


But when it comes to Java, the rules are slightly different:

String tmp1 = “Test”;

String tmp2 = “Other Test”;

(tmp1 == tmp2) = True


In Java, the == operator compares Objects and not the physical values contained within. The line above this is checking if the object tmp1 is the same object as tmp2.

So, in Java, the proper way to compare values is by using the equals() method:

String tmp1 = “Test”;

String tmp2 = “Test”;

(tmp1.equals(tmp2) = True


If it’s anything that I can teach you today, it’s that with Java almost everything is an Object and not just a data type. If it’s an Object, it has Properties and Methods that should be considered at all times, especially when parsing or comparing values.

Cheers for now 🙂