I was reading "Programming in Java Deitel & Deitel 7th Edition" and I watched the precedence of operators but I was with some trepidation.
The author says that when there is a mathematical typical expression in which there are operators of equal precedence operation runs from left to right. For example:
System.out.println (a + b + c - d);
In this sense the operation is executed from left to right, then I research on the internet and I find that the "=" operator runs from right to left. For example:
int x;
x = 4 * 4 * 4% 2;
All taxes fine until I ponogo to investigate further and write code and it occurs to me this, I wrote this exeption:
System.out.println ((4 * 4) + (8 * 8) * (4 * 4) - 16/4);
And my question is this, if the book says that the addition and subtraction have lower priority compared to other operators, What if I add the value of a typical expression multiplied ?. Let me explain:
When I put (4 * 4) + (8 * 8) * (4 * 4)
I am adding the value of the multiplication, then lower the precedence of the operator?
Another question:
If I have an example as follows:
System.out.println (a * b * c + d + e + f * g / h);
As higher precedence operations are executed first order from left to right, when I get the time to run the higher precedence Does it run from left to right as well?
When the value of a variable is assigned, Do operators of higher precedence associate from right to left?