Swarmy, I have Mughal's 1.4 book here and it is rather confusing. At one point on page 67 he says "Relational operators are nonassociative." and then five lines later he says "since relational operators have left associativity"! So the best thing is to get the hands dirty and try things out!
If you compile the following:
the compiler objects with:
This means that the compiler is using left associativity and does 1 < 2 first to get a boolean, and then tries a true < 3 next, which subsequently fails of course.
Try out the other cases for yourself.
I reckon that when Mughal says "Relational operators are nonassociative." he means it mathematically speaking, and when he says "since relational operators have left associativity" he is refering to the Java compilation process.
Because the above example of 1 < 2 < 3 does not compile, this could be the justification of the use of the term "non-associative". [ May 17, 2004: Message edited by: Barry Gaunt ]