The const modifier is used to declare variables that cannot be changed. These variables must be given initial values when they are declared. A const variable is a constant entity. For example, to declare a constant int the following syntax may be adopted.
const int i = 100;
The volatile modifier signals to the compiler that the value of a field may change in ways unknown to the compiler. The value of a volatile field is obtained each time it is accessed and no optimizations are perfomed in this regard.