Definition: A variable with a pre-defined value. When you use constants, you do not want your program to change the value of that variable.
For example, the speed of light is a constant. Its value never changes ( I am using 186282.397 miles-per-second in the example below), and if you want to use it in a program you should probably set it as a constant:
final double SPEED_OF_LIGHT = 186282.397;When declaring constant variables in Java, you should set the variable name to all uppercase letters and separate words with an underscore. This pattern implies that these are constants, and it will be easier to read your code if you follow this standard naming convention.
The final modifier is the indicator that makes SPEED_OF_LIGHT constant and unchangeable (not to mention the actual laws of nature, as well!)
Also Known As: final variables
