Nested Classes
An Introduction with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
Course
class
that has associated Comparator
classes; a ClosedInterval
class that
has associated Iterator
classes)Course
class with "top-level"
CreditComparator
and IDComparator
classesComparator
classes
will only ever be used with the Course
class
(i.e., they can't stand alone), it makes sense
to make them static nested classesClosedInterval
class and associated
IncreasingIterator
classIncreasingIterator
object is associated with
a particular ClosedInterval
object