11
Sometimes I find class codes with Inner class, such as:
class ClasseExterna {
private int a = 10;
// ...
class InnerClass {
public void accessOuter() {
System.out.println("Outra classe " + a);
}
// ...
}
}
I always wonder:
Why and when to use Inner class? I have not yet come across a situation where there was no alternative.