Sample code:
class A {
public doSomethingFancy() {
.....
doJOb();
}
private doJob() {
B b = new B();
}
private class B {
}
}
class B is only needed for class A.Or is only used in class A.
Is there need to declare class B as static ? yes/no Why?
You declare B static if it doesn't need access to the A object it was created for.
You declare B private if only A needs to use it, or other clients only use it via its implemented interfaces.