Dedian  
-- 关注搜索引擎的开发
日历
<2006年5月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
统计
  • 随笔 - 82
  • 文章 - 2
  • 评论 - 228
  • 引用 - 0

导航

常用链接

留言簿(8)

随笔分类(45)

随笔档案(82)

文章档案(2)

Java Spaces

搜索

  •  

积分与排名

  • 积分 - 64847
  • 排名 - 816

最新评论

阅读排行榜

评论排行榜

 
Definition:

A class within another class

Example:

class EnclosingClass 
{
...
class ANestedClass
{
...
}
}

Purpose:

Reflect and enforce the relationship between two classes. (esp. in the scenarios that the nested class makes sense only in the context of its enclosing class or when it relies on the enclosing class for its functionthe nested class makes sense only in the context of its enclosing class or when it relies on the enclosing class for its function)

Interesting features:

1. An instance of InnerClass can exist only within an instance of EnclosingClass
2. InnerClass instance has direct access to the instance variables and methods of its enclosing instance.
3. two special kinds of inner classes: local classes and anonymous classes

reference:
http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html
posted on 2006-05-16 08:22 Dedian 阅读(321) 评论(0)  编辑  收藏 所属分类: Java Glossary

只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © Dedian Powered by: 博客园 模板提供:沪江博客