作用域public、private、protected、以及不写时的区别? 区别如下: 作用域 当前类 同包 子孙类 其他 public √ √ √ √ protected √ √ √ X default √ √ X X private √ X X X 不写时默认default。