a constant is a “value” (specifically a literal value such as int type literal value 4 or string type literal value “Hello”). Thus, “constant” does not refer to (is not the same as) a field or local variable declared with the const modifier. But is a value (an immutable literal value) that can be assigned to either a field or local variable declared or not declared with const modifier. Thus, a (literal) value is still a constant even if it is not assigned to a field or local variable declared with the const modifier or if not assigned to anything at all. And as we know a literal value is immutable thus, it is the same as to say that a constant is immutable.
A field declared with the const modifier is referred to as a “constant field” which must be assigned with a constant (since the const modifier enforces that) upon declaration of the constant field. Also, a constant field cannot be assigned with a new value after its declared (since the const modifier enforces that as well).
A local variable declared with the const modifier is referred to as a “constant local” which also must be assigned with a constant (since the const modifier enforces that) upon declaration of the constant field. Also, a constant local cannot be assigned with a new value after its declared (since the const modifier enforces that as well).
Therefore, "constant" and "constant field" and "constant local" all mean different things.
My prior knowledge on these topics were so far off and incorrect. But this is now my current understanding on the matter. Please correct me if anything I said was incorrect. Many thanks.
What I have tried:
I'm trying to figure out if my current understanding is correct.