java-访问权限

Public:visible to the world.

Protected: visible to the package and all subclasses .

Default: visible to the package. No modifiers are needed.

Private: visible to the class only.

修饰类: Default 或者 public

修饰变量或者方法:四种都可以,但是还是有限制

修饰词本类同一个包的类继承类其他类
private × × ×
无(默认) × ×
protected ×
public
原文地址:https://www.cnblogs.com/live-for-learning/p/12256408.html