Hi -
A quick Google search for "Java operator precedence" took me straight to Sun's official documentation:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/expressions.html You'll note in the table that "equality" (==, !=) has higher precedence than "logical OR". So the expression will be evaluated:
(i == 1) || (j == 2 )
<= THIS WILL, OF COURSE, EVALUATE TO "TRUE"
One thing the
Java page *doesn't* mention is that "&&" and "||" are "short circuit" operators - that is, the second expression will *not* be evaluated if the first one is true. This can often be a very important distinction.
Hope that helps .. PSM
[ February 11, 2005: Message edited by: Paul Santa Maria ]