Summary of private, static, and final identifiers
Reprinted from: http://zhidao.baidu.com/question/163628551.html
1. static indicates static. It belongs to the class. It can be called directly in its own class, or in other classes by class name. method name. Without static, it indicates an instance method and must be called by an instance. The same is true in this class. instance call is required. private indicates private. // For example, private class demo {//. The demo class is private. // note that the class cannot be modified using private. // when the class is modified to private, it does not mean anything. // because no external object can access the demo class. private string STR; // In this case, the STR attribute is private. // The external class cannot access this attribute. Private void Hello () {// In this case, the external class will not be able to access Hello () method: // For example, you certainly want to have some private things. // you can use ordinary people's ideas to Understand Java OOP} // you can use the private Keyword: this makes your Program safer. // variables are usually declared in private. // then, this class controls this attribute through the set get method. 3. final-Modifier (Keyword) If a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be overloaded.