Is there anything like an Internal class in Java?

2019-01-17 19:24发布

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?

7条回答
叛逆
2楼-- · 2019-01-17 20:08

You can make a class package local. This is the default scope for a class. i.e. where you have no access modifiers.

If you really want to put sometime you can create an annotation e.g. @package_local, I do this in places where I speicifc want it to be package local and didn't just leave it unspecificed.

查看更多
登录 后发表回答