| Name: | Inner Classes |
| ID: | m17220 |
| Language: | English (en) |
| Summary: | In Java, besides having fields and methods, a class can also have other classes as members. Just like fields and methods, a class member of can be static or non-static. A non-static class member is called an inner class. Inner class is a programming construct based on the powerful concept of closure prevalent in the functional programming paradigm. It allows on-the-fly creation of objects, which can communicate transparently with the enclosing object inside of which they come into existence. We illustrate the rationale and use of inner classes via a progression from top level helper classes to named static nested classes, to non-static named classes, and to anonymous inner classes with dynamic on-the-fly instantiation. |
| Subject: | Science and Technology |
| Keywords: | anonymous, closure, helpers, inner, nested, object-oriented, on-the-fly, OO, OOP |
| Document Type: | -//CNX//DTD CNXML 0.5 plus MathML//EN |
| License: | Creative Commons Attribution License (CC-BY 2.0) |
|
|
|
| Authors: | Stephen Wong (swong@rice.edu), Dung Nguyen (dxnguyen@rice.edu) |
| Copyright Holders: | Stephen Wong (swong@rice.edu), Dung Nguyen (dxnguyen@rice.edu) |
| Maintainers: | Alex Tribble (prat@rice.edu), Stephen Wong (swong@rice.edu), Dung Nguyen (dxnguyen@rice.edu) |
|
|
|
| Version: | 1.1 (history) |
| Created: | Jun 19, 2008 2:42 pm GMT-5 |
| Revised: | Jul 14, 2008 11:30 am GMT-5 |
| Version: | 1.1 Jul 14, 2008 11:30 am GMT-5 by Dung Nguyen |
| Changes: | new module |
If you derive a copy of this content using a Connexions account and publish your version, proper attribution of the original work will be automatically done for you.
If you reuse this work elsewhere, in order to comply with the attribution requirements of the license (CC-BY 2.0), you must include
See the citation section below for examples you can copy.
The following citation styles comply with the attribution requirements for the license (CC-BY 2.0) of this work:
Wong, S.; Nguyen, D. Inner Classes, Connexions Web site. http://cnx.org/content/m17220/1.1/, Jul 14, 2008.
Wong S, Nguyen D. Inner Classes [Connexions Web site]. July 14, 2008. Available at: http://cnx.org/content/m17220/1.1/.
Wong, S., & Nguyen, D. (2008, July 14). Inner Classes. Retrieved from the Connexions Web site: http://cnx.org/content/m17220/1.1/
Wong, Stephen, and Dung Nguyen. "Inner Classes." Connexions. July 14, 2008. http://cnx.org/content/m17220/1.1/.
Stephen Wong and Dung Nguyen, "Inner Classes," Connexions, July 14, 2008, http://cnx.org/content/m17220/1.1/.
Wong, S., & Nguyen, D. 2008. Inner Classes. Connexions, July 14, 2008. http://cnx.org/content/m17220/1.1/.
Wong, Stephen, and Dung Nguyen. Inner Classes. Connexions. 14 July 2008 <http://cnx.org/content/m17220/1.1/>.