Constants are usually resolved at compile time and are directly inserted into the sequence of commands. Example:
const int A = 10;
int b;
int i = A + b;
will be effectively compiled into:
int i = 10 + b;
For strings, they are interned and put in a heap.
source
share