Does the Java 'final' keyword actually improve security?

前端 未结 12 792
遥遥无期
遥遥无期 2021-01-07 19:07

While there are many reasons to use the \'final\' keyword in Java, one of the ones I keep hearing over and over again is that it makes your code more secure. While this seem

12条回答
  •  说谎
    说谎 (楼主)
    2021-01-07 19:29

    Java's final keyword is not used for this kind of security. It is not a substitute for what would normally require a cryptographic solution.

    What is usually meant by "security" in these kinds of discussions is the concept of a secure object model - that is to say an object model that cannot be manipulated by consumers for purposes unintended by the original author of the class.

提交回复
热议问题