What is Compile Time constant expression value inlined by compiler in JAVA? -


this question has answer here:

recently reading got

"when declare string (which immutable) variable final, , initialize compile-time constant expression, becomes compile-time constant expression, , value inlined compiler used."

and "i'm confused mean value inlined compiler" ? please explain in simple way if possible

source of above line

when string finalized , initialized @ compile time, compiler can copy-paste string code, instead of looking variable @ every use. similar inline expansion.

final string = "asd"; string b = a; 

the above snippet becomes

final string = "asd"; string b = "asd"; 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -