You can apply access restrictions using access modifiers. I will introduce them in order from the least restrictive.
Summary of this article:Day 15 explains modifiers in Java. Modifiers are prefixes that can be applied to methods and variables within a class, as well as to the class itself. The order of modifiers ...