哪个Java访问修饰符仅允许其他包中的子类访问成员? [英] Which Java access modifier allows a member to be accessed only by the subclasses in other package?
本文介绍了哪个Java访问修饰符仅允许其他包中的子类访问成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不得不稍微缩短标题。这是完整的问题:
在Java中,哪种访问修饰符仅允许成员通过其他包的子类或该成员类的包中的任何类访问成员? / p>
我正在考虑受保护的
,但我的办公室同事说答案是私有
。
解决方案
在Java中,访问修饰符仅允许成员访问
I had to shorten the title a bit. Here's the full question:
In Java which access modifier allows a member to be accessed only by the subclasses in other package or any class within the package of that member's class?
I am thinking protected
but my office mate says the answer is private
.
解决方案
In Java which access modifier allows a member to be accessed only by the subclasses in other package or any class within the package of that member's class?
这篇关于哪个Java访问修饰符仅允许其他包中的子类访问成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文