在Java中,什么是嵌套类,它们做什么?
问题描述:
在Java中,什么是嵌套类,它们是做什么的?
In java what are nested classes and what do they do?
答
它们只是其他类中的类.它们使类的层次结构成为可能,如果您将它们设为私有,则这是使用它们封装不在类外部公开的数据的便捷方法. Sun提供了有关它们的简短教程
They're just classes within other classes. They make it possible to have a hierarchy of classes, and if you make them private they're a convenient way to encapsulate data that isn't exposed outside of the class using them. Sun has a short tutorial about them