The final keyword modifiers and rights

final modification of a class: class member method can not have children can not be overwritten

A final modification method: This method can not be overridden conflict with the abstract keyword

final modification of a local variable assigned only variables can not be changed once the value of final int num; num = 1;

final data for basic type is unchanged

For the final reference type is an address change

        public  >  prtecte  >  (defalt)  >  private

The same class yes yes yes yes

The same package Yes Yes

Buns different classes Yes No

Are different packages already sub-class No No  

Guess you like

Origin www.cnblogs.com/xzwx668/p/12104942.html