Access modifiers are added when declaring a class or its members to specify where they can be accessed.
There are four types of access modifiers: "public", "protected", "none", and "private". This time, the accessibility of each access modifier is summarized in the table.
|Own class||Same package||Subclass||Other packages|
Let's take a look at the table using the protected modifier as an example.
"If it has the protected modifier, it can be accessed from within the same package as your class and from subclasses, but not from other packages."
is what it means.
Personally, "protected" and "none", "same package" and "subclass" are confusing. I think this is because I don't have a clear understanding of when protected and packages are useful, so I will study.