Inner classes (static or not) have exactly the same access to their enclosing class' fields and methods as anonymous classes, the difference between static inner classes (actually called nested classes) and (regular, non-static) inner classes being that the static one need an explicit reference to an instance of the enclosing class to access something. Of course, when you need to do that, it's usually on the instance of the enclosing class that created the inner class, so it's easier and clearer to use a non-static inner class.
Examples:
Inner class (non-static)
class A {
private int field;
private class B {
public void doSomething() {
field++; // Valid
}
}
}
Nested class (i.e. "static inner class")
class A {
private int field;
private static class B {
public void doSomething(A a) {
a.field++; // Valid
}
}
}
Anonymous class
class A {
private int field;
public void doSomething() {
new Runnable() {
@Override
public void run() {
field++; // Valid
}
}
}
}
Whether you use that accessibility is another question. If you do access private fields of the enclosing class, there'll be an accessor generated, so it could impact the performance as the cost of calling a method is not the same as accessing a field, but it will probably be negligible in most cases. You should always write correct code first (both in terms of design and functionality) before doing micro-optimizations not based on any measurement. The JIT compiler does a lot of things for you anyway.