Rokiのチラ裏

学生による学習のログ

Java Evaluate Operands before Operation

Java の order of eval についてメモ。

x = 1;
x = ++x + x++; // 3 が保証される

JLS 15.7.2. Evaluate Operands before Operation から引用。

The Java programming language guarantees that every operand of an operator (except the conditional operators &&, ||, and ? :) appears to be fully evaluated before any part of the operation itself is performed.