Variables: const
const bar = 1000000; // Unit of pressure (dynes/cm2)
const double atm = 1.01325 * bar; // Standard atmosphere - A const variable is a compile-time constant.
- Const variables are implicitly final.
- If the const variable is at the class level, mark it static const.
- The const keyword isn’t just for declaring constant variables. You can also use it to create constant values, as well as to declare constructors that create constant values. Any variable can have a constant value.
Semantic portal