The final keyword is mainly used to declare that this thing is immutable. for design and efficiency.
final parameter: used to declare that this parameter is immutable. If the parameter is a constant, it will never be changed, and the virtual machine can perform some operations at compile time. Save some overhead and improve efficiency. Note: The virtual machine must confirm that it is a constant in the editor before some operations can be performed. If the assignment is performed at runtime, it will not work.
If the final modification is a handle, the object pointed to by the handle will never change, but the content of the object can change.
The final modified method means that the method cannot be inherited and overridden.
Final modified class: the class cannot be inherited
java final keyword
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326976288&siteId=291194637
Recommended
Ranking