Final
Final classCannot be inherited, No subclass. The methods in the final class are final by default.
Final MethodIt cannot be overwritten by the quilt method.,Can be inherited.
FinalA member variable represents a constant and can only be assigned once., And the value will not change after the value is assigned.
Final cannot be used to modify the constructor.
1. Final class
The final class cannot be inherited. Therefore, the member methods of the final class have no chance to be overwritten. By default, they are all final. When designing a class, if the class does not need a subclass, the implementation details of the class cannot be changed, and it is sure that the class will not be loaded and extended, it is designed as a final class.
2. Final Method
If a class does not allow its subclass to overwrite a method, you can declare this method as a final method.
There are two reasons for using the final method:
First, lock the method to prevent any inheritance class from modifying its meaning and implementation.
Second, efficient. The compiler transfers the final method to the embedded mechanism to greatly improve the execution efficiency.
3. Final variable (constant)
The final modified member variable is used to represent constants. Once given, the value cannot be changed!
4. Final Parameters
When the function parameter is of the final type, you can read and use this parameter, but you cannot change the value of this parameter.
Abstract: http://java.chinaitlab.com/base/724785.html