在Java中,什么是嵌套类,它们做什么? [英] In java what are nested classes and what do they do?

查看:91
本文介绍了在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

这篇关于在Java中,什么是嵌套类,它们做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆