Conditional comparison is done by casting the second item to the type of the first first, so to get a String comparison it should be if a = b then. In general when using an Object type in a comparison then it should be on the right as what is probably intended is a comparison of the type of the other (first parameter). This can also be important if you are comparing numeric values and String types, to get a numeric comparison the numeric type needs to be on the left or you may get unexpected results as String values may have leading or trailing zeroes.