Java fun fact: Can access modifiers restrict access to class members?
Published in
2 min readAug 23, 2021
Knowing about access modifiers is the first step to starting with the java programming language. In this article, I’m going to demonstrate how access modifiers can control access to class members and when they can’t.
Revise knowledge
Access level modifiers determine whether other classes can use a particular field or invoke a particular method. There are four access modifiers, they are:
- private → class members only are accessed inside its class.