The final keyword modifiers and four rights

First, the meaning of the final keyword: ultimate, unchangeable, can be modified classes, methods and variables

  Class: final modified class can not be inherited (all members of the methods can not be overwritten)

  Method: The final modification of the method can not be rewritten (abstract and can not be used with final)

  Members: the final modified when members must be manually assigned (assigned by the constructor or direct assignment), must ensure that the final member variables will eventually be assigned

  Local variables: assigning only once (if the reference type on behalf of which the address value is not changed, but the contents stored in the address can change)

Second, the four permission modifier

In each case whether to access to
  public protected default (omitted) private
The same class
Class has nothing to do with a package  
Different classes buns    
Different packages unrelated classes      

Permission from big to small: public> protected> default> private (default default not write)

 

Guess you like

Origin www.cnblogs.com/haoyujun135/p/11332365.html