有什么像Java中的内部类吗? [英] Is there anything like an Internal class in Java?
本文介绍了有什么像Java中的内部类吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C#中,您可以将类标记为 internal
,以便它只能从同一个包中访问。
In C# you can mark a class as internal
so that it is only accessible from within the same package. Is there anything similar in Java?
推荐答案
您可以通过省略安全修饰符(public,private)来创建包私有类类的声明。
You can create package-private classes by omitting the security modifier (public, private) from the class's declaration.
package com.sample;
class MyPackagePrivateClass
{
...
}
这篇关于有什么像Java中的内部类吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文