Home >Topic List >Introduction to java access control modifiers

Introduction to java access control modifiers

There are four types of java access control modifiers, namely public, protected, private, and default access modifiers. Detailed introduction: 1. Public, public is the loosest access control modifier. Modified classes, methods and variables can be accessed by any other class. When a class, method or variable is declared as public, they can be accessed anywhere be accessed, whether it is a class in the same package or a class in a different package; 2. protected modifier, etc.