
Java 26 - part 1: JEP 500 Prepare Final Mean Final
When you have been writing Java for a while, you may have noticed that you are writing final a lot. You typically use it when defining class or instance variables. In those situations the compiler will ensure that you assigned a value to it before the class constructor completes. Or you could use it with parameters to indicate that the values of these parameters should not be tinkered with. It is Java’s version of defining a constant. Or at least, that is what we have been thinking. But in real life, a final variable can be changed. Take a look at the following example: ...
