10.6. final Parameters
In a method declaration, the final keyword can be used preceding the formal parameter declaration. The initial value of the final parameter is uninitialized (blank) and when the value is assigned, it cannot be changed during method execution.
- The compiler can treat final variables as constants for code optimization purposes.
- Declaring parameters as final prevents their values from being changed inadvertently