Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Remember, when we talk about an inner class accessing something in the outer class, we’re really talking about an instance of the inner class accessing something in an instance of the outer class. But which instance?
Can any arbitrary instance of the inner class access the methods and variables of any instance of the outer class? No!
An inner object must be tied to a specific outer object on the heap.
Make an instance of the outer class
Make an instance of the inner class, by using the instance of the outer class.
The outer and inner objects are now intimately linked.