In program execution, the amount whose value cannot be changed is called a constant, and the amount whose value can be changed is called a variable.
One, variable
1. The variable name must be a valid identifier
2. Variable names cannot be duplicated
3. You should choose a meaningful word to make a variable name
Second, constant
Constants are also commonly referred to as "final variables", and constants can be assigned only once throughout the program and are shared for all objects.
In the Java language, declaring a constant, in addition to specifying a data type, needs to be qualified with the final keyword.
Standard syntax: Final data type constant name [= value]
Constant names are usually capitalized, which is not a rule, but most Java programmers are accustomed to using uppercase letters to denote constants, often to make it clear that constants are being used.
Cases:
Java Variables and constants