javaconstantfolding

is there any concept called "Constant Folding" in java?


is there any concept called "Constant Folding" in java? if yes what is it?


Solution

  • Constant folding is the process of simplifying constant expressions at compile time. Terms in constant expressions are typically simple literals, such as the integer 2, but can also be variables whose values are never modified, or variables explicitly marked as constant

    Yes, it's exists on Java: Compiler optimizations