Possible Duplicate:
protected/public Inner Classes
I am sure the question has been asked already, but I wasn’t able to find one so I’ll ask…
I am curious what is the difference between private(protected) and public inner class. I am able to use both from out of the containing class using the outer class object.
public class A{
private class B{
}
public static void main(String[] args){
A a = new A();
B b = a.new B();
}
}
A private inner class can still be accessed within the class that defined it.
If you have another class,
Bisn’t visible: