Switch its visibility to package or protected
时间: 2023-12-14 08:36:55 浏览: 72

display和visibility的区别
To switch the visibility of a class or method to package or protected, you can modify its access modifier in the class definition.
To make the class/package-private, remove any access modifier from the class definition. For example:
```
class MyClass {
// class definition
}
```
This class will have package-private visibility, meaning it can only be accessed by other classes in the same package.
To make the class protected, add the `protected` keyword before the class definition. For example:
```
protected class MyClass {
// class definition
}
```
This class will have protected visibility, meaning it can be accessed by other classes in the same package as well as by subclasses of this class, even if they are in different packages.
阅读全文
相关推荐














