One of the purposes of introducing inner classes in Java is to protect them from being accessed from outside their surrounding classes. Problem is while we choose to encapsulate a specific functionality into a class, why do we limit its visibility at the same time?
1. To factor it out from the surrounding class in order to organize our code in a more structural way;
2. To preserve the ability to freely modify the inner class in the future; present reusability sometimes conflicts with future flexibility. To elaborate on this issue, consider one situation where we define part of a larger class(ClassA) as another class--------instead of one of its inner class--------and for further reference we call this class ClassB. And apart from ClassA yet another class(ClassC) also composes ClassB, as illustrated by the following diagram:
Reusability has been achieved--------ClassB is being reused by ClassA & ClassC.
Now suppose ClassA need to be revised to meet some new requirements and this can't be done without also touching ClassB. Since ClassC has composed ClassB, it can't avoid being affected. This is how present reusability sometimes conflicts with future flexibility.
In contrast, when implementing ClassA & ClassC, if we'd chosen to define ClassB as inner classes of their own in the first place, ClassA & ClassC would have had been able to evolve independently without affecting one another: