For students who have just graduated , the interview will be a relatively easy topic (I encountered a few times when I just graduated in the interview). After all, these four access modifiers are relatively basic knowledge points, generally memorize permission access first. The more "strict" private access modifiers are memorizing others. Of course, you choose the memory method you are good at to understand it. After all, rote memorization will forget it soon. The foundation is still very important.
access modifier
|
this class
|
Same package
|
Subclass
|
other
|
private
|
√
|
×
|
×
|
×
|
Default (friendly)
|
√
|
√
|
×
|
×
|
protected
|
√
|
√
|
√
|
×
|
public
|
√
|
√
|
√
|
√
|