Basic HTML version of Foils prepared 19 July 97

Foil 19 Inner Classes - Member Classes

From Overview of JDK Version 1.1 Extensions CPS616 -- Information Track of CPS -- Spring Semester 97. by Nancy J. McCracken


A class can be defined as a member of another class, analogous to instance variables and methods.
The code within the member class can refer to any fields and methods of the enclosing class.
Every instance of a member class is associated with a particular instance of the enclosing class.
Syntax: public class A { //declare instance variables and methods of A here //methods may create new B private class B { //declare instance variables and methods of B here //methods can refer to instance vars and methods of A } }



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998