到Think in Java中去看看,保证你会有收获

解决方案 »

  1.   

    This is where inner classes come into play. They allow two things: 
    1、To create the entire implementation of a control-framework application in a single class, thereby encapsulating everything that’s unique about that implementation. Inner classes are used to express the many different kinds of action( ) necessary to solve the problem. In addition, the following example uses private inner classes so the implementation is completely hidden and can be changed with impunity.
    2、Inner classes keep this implementation from becoming awkward, since you’re able to easily access any of the members in the outer class. Without this ability the code might become unpleasant enough that you’d end up seeking an alternative.摘自《think in java》