Publication View

Inner Classes (2008)

Abstract
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.

Publication details
Download http://cnx.org/content/m17220/1.1
Repository Connexions (United States)
Keywords OOP, OO, on-the-fly, object-oriented, nested, inner, helpers, closure, anonymous
Language English