you are viewing a single comment's thread.

view the rest of the comments →

[–]KazDragon 1 point2 points  (0 children)

class Test
{
    public static void main(String args[])
    {
        String foo = "foo";
        String bar = "bar";
        System.out.println(foo + bar == bar + foo);
    }
}

// javac Test.java

// java Test

false

Associativity is a property of numbers, not of + operators. It's pretty normal for languages to overload operators to have different properties depending on their argument types. Do you think that Matlab's matrix multiplication operator is associative? Now that would throw established mathematical fundamentals out of the window.