Hi,
Ranchers, please correct me if I'm wrong.
What I get from a compile-time constant is a 'final' identifier declared and assigned a literal value. Something like
Now, obviously this can be either one of the primitives or a
String ('cause literals can only be written for them).
The reason such an identifier is called a compile-time constant is that compiler can safely assume the value of the same and for optimal performance, may 'replace' its value whereever it is used in code.
A run-time constant can be thought of as a 'final' identifier which is assigned a value that can be decided only at run-time.
Example,
or
Hope this helps.
- Aditya Jha