Dedian |
|
|||
-- 關注搜索引擎的開發 |
日歷
統計
導航常用鏈接留言簿(8)隨筆分類(45)
隨筆檔案(82)
文章檔案(2)Java Spaces搜索積分與排名
最新評論
閱讀排行榜評論排行榜 |
Definition:
A class within another class Example: class EnclosingClassPurpose: 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
|
![]() |
|
Copyright © Dedian | Powered by: 博客園 模板提供:滬江博客 |