java modifier
A class modifier
Access modifier : public modifier public (if not written, only this class and the same package can access)
Non-access modifiers : abstract class modifier abstract, final modifier final
An interface has only access modifiers, and access modifiers of the same kind
2. Attribute modifiers
Access modifiers :
Access Class Package Subclass Other Packages
public ∨ ∨ ∨ ∨ (available to anyone)
protect ∨ ∨ ∨ × (inherited classes can access and have the same permissions as private)
default ∨ ∨ × × (package access permission, that is, it can be accessed in the entire package) default cannot be written by default
private ∨ × × × (elements that cannot be accessed by anyone other than the type creator and the type's internal methods)
Non-Access Modifiers :
static static modifier
final final modifier
volatile volatile (shared) field modifier
transient transient domain modifier
Third, the method modifier
Access modifier : Access modifier for the same property
Non-Access Modifiers :
abstract abstract method modifier
static static method modifier
final final method modifier
native native method modifier
synchronized synchronized method modifier