Most people confused with the access modifiers in java so lets talk little bit about it. The confusing part is “private” and “not defined modifier” as an example if declared the two variables with in the class as follows then where I can access those
private int can_see_for_class; int can_see_with_in_package;
Java by default it has been assigned the package private that means you can access your variable with in the same package.
Private : Like you’d think, only the class in which it is declared can see it.
Package Private : Can only be seen and used by the package in which it was declared.
Protected : Package Private + can be seen by subclasses or package member.
Public : Everyone can see it.