This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Mukul Anand wrote:At page no. 63, section 3.10.5,
The Java Language Specification for Java 5/6 states that
Strings computed by constant expressions (§15.28) are computed at compile
time and then treated as if they were literals.
What does the phrase "computed at compile time" mean? It sounds as if those String objects are created at compile-time, which is funny.
This just means that it is computed by the compiler. For example...
There is no "hello", " ", or "world" strings created by the generated code. The generated code creates the "hello world" string directly -- because the result is computed at compile time. It is as if the code was ...