Junilu Lacar wrote:In both your #1 points, your interpretation of how operator precedence works is incorrect. Think of operator precedence as putting explicit parentheses around the terms of an expression. After explicit parentheses have been added, evaluation of the expression still proceeds from left to right. The effects of pre-increment operations are applied as you go. So, in the first pre-increment of the variable i, its value becomes 10. When you get to the second i with post-increment, the value 10 is used, not 9.
Consider A() + B() + C() * D(). Multiplication is higher precedence than addition, and addition is left-associative, so this is equivalent to (A() + B()) + (C() * D()) But knowing that only tells you that the first addition will happen before the second addition, and that the multiplication will happen before the second addition. It does not tell you in what order A(), B(), C() and D() will be called!
Junilu Lacar wrote:Consider this expression:
1 + 2 * 3
This expression is evaluated as 1 + (2 * 3), which results in the value 7, not 9.
It is good; there are a few tiny errors, e.g. saying that + is overloaded when both its operands are String type. Since the article mentions the Math class' exact methods, it appears to be reasonably recent.Dani Garcia wrote:thanks for that resource..it is wonderful!!!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |