The 1 th meaning is a value, and the value itself, we can call it a constant, and give several examples:
Integer constant: 123
Real constant: 3. 14
Character constant: "a"
Logical constants: true, false
String constant: "helloworld"
This is just talk, for example, the number 7, we can say "an int constant 7"
-
There is another one, which was asked by the landlord:
The second layer means immutable variables, also called constants. Grammatically speaking, it is final. You modify a variable with the final keyword, and then as long as it is assigned, it can't be changed, and it can't be assigned again. According to one example:
final int I = 0;
Then the value of this I can never be changed, it can only be 0, so it is an immutable variable. This sentence seems contradictory, but it is not contradictory. This sentence is understood as follows:
I is a variable of type int, and the variable itself is changeable (the value can be changed), but now it is immutable because of the addition of final, so it is immutable.